INSERT INTO TB2 + (U_FirstName, + U_LastName, + U_Address1, + U_City, + State_ID, + U_Zip) + SELECT + TB1.First_Name, + TB1.Last_Name, + TB1.Address, + TB1.City, + ST1.State_ID, + TB1.Postal_code + FROM TB1, ST1 WHERE ST1.State_Abbrev=TB1.State_Abbrev
On 3 Sep 2003, at 12:53, Fogelson, Steve wrote: > I have 3 tables. One is a table (TB1) of names and addresses with the State in > abbreviated format (IE: MN). One is a table (TB2) of name and addresses with the > State as an ID that relates to the third table (ST1) of states with an ID and > abbreviation. > > I want to insert rows from TB1 into TB2 and translate the abbreviation into an > ID based on ST1. The following doesn't work as it seems to use the 1st SELECT. > Any ideas? > > INSERT INTO TB2 U_FirstName, U_LastName, U_Address1, U_City, (SELECT > ST1.State_ID FROM ST1 WHERE ST1.State_Abbrev=TB1.State), U_Zip > SELECT First_Name, Last_Name, Address, City, State, Postal_code FROM TB1 > > Thanks > > Steve Fogelson > Internet Commerce Solutions >

