Reputation: 85
I have table its name is FDWelcomeCall
and there are columns wcstatus
and datecompleted
.
I want to select datecompleted
. But I want to set the value of datecompleted
to NULL
if the wcstatus
value is 0
or 1
, other than that the value of datecompleted
will be appeared normally.
Upvotes: 3
Views: 50
Reputation: 222582
You could use a CASE
construct, like :
SELECT CASE WHEN wc_status IN (0, 1) THEN NULL ELSE datecompleted END datecompleted
FROM FDWelcomeCall
If you are looking to actually set datecompleted
to NULL
when wc_status
is 0
or 1
:
UPDATE FDWelcomeCall
SET datecompleted = NULL
WHERE wc_status IN (0, 1)
Upvotes: 3