dflow Posted May 6, 2010 Share Posted May 6, 2010 i have a CityName Column in an old products table i would like to create a CityID according to the cityname and update the CityID column i have city_list table with CityID as primary CityName products table ProductID as Primary CityID (Blank INT) CityName(with cityname varchar) so insense have CityName=Amsterdam=CityID=1 how can i run an update column CityID according to city_list cityname hope im clear thanks Quote Link to comment Share on other sites More sharing options...
luca200 Posted May 6, 2010 Share Posted May 6, 2010 hope im clear you could do better actually :-D Anyway, hoping I understood, you could give it a try like this: update products p join city_list c on (p.CityName = c.CityName) SET p.CityID = c.CityID Quote Link to comment Share on other sites More sharing options...
dflow Posted May 6, 2010 Author Share Posted May 6, 2010 you got me loud and clear thanks alot Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.