0
UPDATE Customer C SET name = B.name, age = B.age FROM (SELECT A.*, B.* FROM CUSTOMER_TEMP WHERE A.ID = B.ID) AS B 

I got a sql as above, after I run the query, it update all my rows to the same result.

I wonder I need a where after

UPDATE Customer C SET name = B.name, age = B.age FROM (SELECT A.*, B.* FROM CUSTOMER_TEMP WHERE A.ID = B.ID) AS D WHERE C.ID = D.ID 

But i got this id is ambiguous for the last query.

0

1 Answer 1

0

Try this

update Customer set name = B.name, age = B.age from Customer as C inner join CUSTOMER_TEMP as B on B.ID = C.ID 

SQL FIDDLE EXAMPLE

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.