May 21, 2008 at 2:49 am
Hi,
I have three columns and want to update the third column based on the comparison of first two columns in the same table.
For instance:
Col1 - val1, val2, val3, val4, val5......
Col2 - NULL, NULL, val1, NULL, val2....
Col3 - TRUE, TRUE, FALSE, FALSE, FALSE....
Thanks for any help.
May 21, 2008 at 3:44 am
check BOL for the case statement;
update mytable
set col3 = case when col1='abc' and col2 = 'def' then col4
else Col3 -- if you don't code the else, it will perform set NULL !!
end
where col5 = 123
Johan
Learn to play, play to learn !
Dont drive faster than your guardian angel can fly ...
but keeping both feet on the ground wont get you anywhere :w00t:
- How to post Performance Problems
- How to post data/code to get the best help[/url]
- How to prevent a sore throat after hours of presenting ppt
press F1 for solution, press shift+F1 for urgent solution 😀
Need a bit of Powershell? How about this
Who am I ? Sometimes this is me but most of the time this is me
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply