April 23, 2013 at 7:43 am
Morning guys,
I need a lil help with an update query...
I have a working table that has all these columns in it...two of the columns are CustomerID and IDAlias...When importing into the table it loads everything except the IDAlias column...I have this other working table that has CustomerID and IDAlias in it...This is where the alias' are populated...
The thing is: I need to populate the first working table with the alias' for each CustomerID using the other working table that has the alias for each customerID...
The statement that I have been doing :
UPDATE TableA
SET IDAlias = (SELECT Alias FROM TableB INNER JOIN TableA ON CustomerID = CustomerID)
I keep getting subquery returned more than 1 value and I understand that error...Im just confused on how to populate that alias field...
April 23, 2013 at 7:47 am
UPDATE T1 --TableA
SET IDAlias = T2.Alias
FROM TableB T2 INNER JOIN TableA T1
ON T1.CustomerID = T2.CustomerID
April 23, 2013 at 8:05 am
That was it...Thank you very much!
April 23, 2013 at 8:07 am
you're very welcome.
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply