I've got a simple table below,
Select * from message_log where Message = 'BUILD' order by 1;
+------------+-------------+
| **Message | Log** |
+------------+-------------+
| Build | Day Start |
+------------+-------------+
| Build | Day End |
+------------+-------------+
| Build | Dusk Start |
+------------+-------------+
| Build | Dusk End |
+------------+-------------+
| Build | Night Start|
+------------+-------------+
| Build | Night End |
+------------+-------------+
If I for example write a CASE statement
SELECT DISTINCT CASE WHEN (Log = 'Day Start') THEN 'RUNNING' END AS A
from message_log where Message = 'BUILD' order by 1;
It'll return a Null value and a 'RUNNING' value, can I write this in such a way that it doesn't include the null row?
CASE
statement doesn't include any otherWHEN
options for values other than "Day Start", so all the others will return asNULL
. Either add anotherWHEN
to handle the other values or use yourWHERE
clause to only return "Day Start" values if that is your goal.