"Orwell" <orwellnelson (AT) usa (DOT) com> wrote
Quote:
This is probably a stupid question, but here goes: I am trying to
update a table differently based on what is in one of the columns
within the table. For example, I want to set Fld1 to be "On" if Fld2
is "A", and I want to set Fld1 to be "Off" if Fld2 is "B". This is
easy to do in two SQL statements, but I was wondering if there's some
way to do it in a single SQL statement. Thus far, I have had no luck
in figuring out how to do this. Any ideas would be appreciated!! |
UPDATE T
SET Fld1 = CASE WHEN Fld2 = 'A'
THEN 'On'
ELSE 'Off'
END
WHERE Fld2 = 'A' OR Fld2 = 'B'
Regards,
jag