Forum Moderators: open

Message Too Old, No Replies

how to select all uniques from a table and insert into a DB

         

8kobe

12:30 am on Nov 6, 2007 (gmt 0)

10+ Year Member



I have a large DB (388 mb) that I am looking to optimize as it isn't currently (surprise). I want to select all the unique values from the DB for a particular column called complete_name and insert them into the table player in the column complete_name and replace the complete_name with an id.

so
ball.complete_name -> player.complete_name
player.id -> ball.complete name

-> denotes where I want to move that information.

syber

10:26 pm on Nov 6, 2007 (gmt 0)

10+ Year Member



what database are you using?

eelixduppy

7:44 am on Nov 7, 2007 (gmt 0)



You want to use the DISTINCT [dev.mysql.com] keyword to select unique values from a table. Write an insert query that selects the distinct rows and inserts them into a new table.