August 16, 2012 at 12:51 am
Hi,
I have 2 table as A(totalmarks, maths, english, class1) and there is another table B(class2)
Now i want to do the following,
Update A
if class2 > class1
set totalmarks = maths + english
how to achieve the above.
August 16, 2012 at 2:02 am
If I understand you correctly, smth like this:
update a
set
totalmarks = case when b.class2 > a.class1 then maths + english else totalmarks end
from
A a
join B b on -- some join condition
Upd:
removed join condition
August 16, 2012 at 2:35 am
Yup you are right. I had figured it out. i was not knowing that we are able to used from with update. Between thanks for reply:-)
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply