On 12/18/2012 12:27 PM, Adam DeVita wrote:
There is a table products where has a location id. Unfortunately
duplicate dictionary names got added to list of locations
products has locationid and a bunch of other stuff
I can easily get the max (bad) and min (good) location ids
associated with each name (I know I should have made the name field
UNIQUE... mistakes were made years ago)
how do I write an update that essentially says
update products set locationid = good where locationid = bad , but do
it for each good & bad pair ?
update Products set locationid = (
select min(locationid) from Locations where name =
(select name from Locations L where L.locationid = Products.locationId)
);
--
Igor Tandetnik
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users