Iam trying to write a CASE statement in my php query. There is a field called overall_status, it contains certain data. But some rows its NULL. So where ever data is there it has to show the data or if its NULL or EMPTY, it should show 'UNKNOWN'. This case statement i tried. But not getting the desired result. So many records i could see 'Null' record, that is its not showing any data. Can someone pls help me on this.
CASE quot_status.overall_status IS NULL WHEN 1 THEN 'Unknown' ELSE overall_status
END AS `overall_status`
Try this:
CASE
WΗΕΝ quot_status.overall_status IS NULL OR
quot_status.overall_status = '' THEN 'Unknown'
ELSE overall_status
END AS `overall_status`