Subject | CASE and SQL |
---|---|
Author | Michael Vilhelmsen |
Post date | 2005-01-20T10:54:16Z |
Hi
When doing a SELECT I can use CASE statement.
Something like:
Select
Field1,
Case when (SomeCondition) then
FIeld2
else
Field3
end
from MyTable
Can I do something alike when doing and update ?
I.E.
Update MyTable set
FIeld1 = SomeVAlue,
Case when (SomeCOndition) then
Field2 = 1
else
Field3 = 2
end
Regards
Michael
When doing a SELECT I can use CASE statement.
Something like:
Select
Field1,
Case when (SomeCondition) then
FIeld2
else
Field3
end
from MyTable
Can I do something alike when doing and update ?
I.E.
Update MyTable set
FIeld1 = SomeVAlue,
Case when (SomeCOndition) then
Field2 = 1
else
Field3 = 2
end
Regards
Michael