update w/self referencing select?
dkolearyNov 10 2009 — edited Nov 10 2009Hey;
This doesn't seem like it should be too difficult; however, I can't seem to wrap my head around it.
I have a table w/following structure:
city
state
region
Due to the way the table is getting populated, some of the regions are null. Such that:
madison
wisconsin
Midwest
and
milwaukee
wisconsin
<null>
I would like to periodically update the region column with relevent information.
I'm pretty sure I need a look up table and have already generated one:
create table as
(select unique state region
from regions where region is not null);
but, I can't quite seem to grasp the sql to update the regions table from the lookup. Probably my procedural programming mindset getting in the way again.
Can someone provide the needed clue?
Thanks.
Doug O'Leary