[SGVLUG] SQL Question - UPDATE
Greg Stark
gstark at electrorent.com
Mon Feb 19 13:54:50 PST 2007
I can't seem to wrap my mind around this problem.
I need to update a column in a table(1) where the source comes from another
table(2) base on a value from that row for the whole table(1). What I do
not want to do is loop through table(2). Let me illustrate.
Table1 has columns: FullState, State + other columns
Table2 has just columns: FullState, State
I want to update the State in Table1 with the State in Table2
where Table1.FullState = Table2.FullState
UPDATE Table_1
SET State = [Table_2].[State]
FROM Table_2
WHERE [Table_1].[FullState]=[Table_2].[FullState]Thank you.
Greg
More information about the SGVLUG
mailing list