-
Using Case and Joins in update statement
Hello everyone..!
I need to update a table by using both Join and case statements. I am not very good at SQL. Please find the code given below written by me...
update t1 a
set a.name2=
(case
when b.msg2 in ('bingo') then '1'
when b.msg2 in ('andrew') then '2'
when b.msg2 in ('sam') then '3'
else '4'
end )
from t1 a left outer join t2 b
on a.name1 = b.msg1 ;
I am getting an error saying the SQL command not ended properly..Please help me...
I really appreciate your help !
Thanks in advance...
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|