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.
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)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With