I had a reference table for all of the World Countries that i wanted to extract Currency data from to another new table. I initially use this code which created a new table with 263 records.
CREATE TABLE currencies SELECT tld, currency, currencycode FROM countries ;
I quickly realized that for the purpose I was creating this table, which is to have a unique list of currency codes, this didn’t work. The 263 rows were 99 too many as there are only 164 unique currency codes in my table. Dug around the net for a while and came up with this query:
CREATE TABLE currencies SELECT tld, currency, currencycode FROM countries GROUP BY currencycode;
That took care of my initial problem.
Reference
Like this:
Like Loading...
Published by Abou Kone
I am a front end architect with 10+ years of experience in web development. The best part of the process for me is converting ideas into code and solving the technical problems that come along. Alongside providing technical leadership and architectural support to projects spanning multiple industries, I am also experienced in leading discussions with designers, developers, and business stakeholders helping to guide teams in turning complex business workflows or data into easy-to-use web and mobile interfaces. I believe in delivering high quality products and am constantly looking into improving the process and tools use to achieve this goal.
View more posts
Useful solution here..
How to delete duplicate rows with SQL
http://www.xaprb.com/blog/2006/10/11/how-to-delete-duplicate-rows-with-sql/