Convert an excel sheet into IDs automatically (1 Viewer)

ElcoyotldeAztlan

Registered User.
Local time
Today, 09:55
Joined
Jul 15, 2017
Messages
43
Hello All,

Lets say I have a table that has 27 color IDs that match 1000 cars in another table. I have an excel sheet that lists all the colors that match the cars, If I import all 1000 colors (which would mean that they would be duplicate colors because there are only 27 unique colors) from excel. Could I use SQL to automatically convert all 1000 colors into the 27 color IDs

I would understand there would be multiple color IDs 1-27. the goal would be to copy those IDs and match with the Car table

Please let me know If I need more explaining
Thoughts?
thanks
 

JHB

Have been here a while
Local time
Today, 18:55
Joined
Jun 17, 2012
Messages
7,732
To get unique values from a list of duplicates, use the keyword DISTINCT in the Select statement.
Code:
[COLOR=black]SELECT DISTINCT [I]column1[/I],[I] column2, ...[/I]
  FROM [I]table_name[/I]; [/COLOR]
 

ElcoyotldeAztlan

Registered User.
Local time
Today, 09:55
Joined
Jul 15, 2017
Messages
43
Thanks but would the distinct values be from the "27 color IDs" how would the unique values automatically be connected with those IDs

I'm thinking I would have a table with 27 IDs and the 27 color names
and I would have a column of the 1000 duplicate colors on another table no IDs
so I'm thinking I could connect the two tables by name and the IDs could be filled out that way
would this code be able to connect the 27 IDs with the 1000 duplicate colors?
I'm I making sense?
 

Users who are viewing this thread

Top Bottom