Hello everyone, today's I am going to share the query for select true and false based on column value using the SQL CASE as given below.
CASE WHEN ColumnName IS NULL THEN 'False' ELSE 'True' END
In the below example, UNIT is a table name and UNITID, UNIT and UPDATEDATE is the columns name. Here I using the case on UPDATEDATE column.
For the detail you can see the example.
WHEN E.UPDATEDDATE IS NULL THEN 'NOT UPDATED'
END AS RTURNING
FROM UNIT E
WHEN MP.MOBILENO IS NULL THEN 'False'
END AS ADDONS
FROM MASTERPLAN MP WHERE MP.EQUIPMENTID=8
Please see the live output as given in below screen.