I’m trying to sum the values of two columns into a new one, its for analysis purpose (not creating a new column in the database)
I tried using case statement but I have no idea what is happening :
(Basically what I’m trying to say is: if the sum of the 2 columns is equal or grater than one, then count it as 1, if its 0 or null then skip and return zero)
please see the attached pictures
>Solution :
Your case statement should look like this to handle null values properly.
SELECT CASE WHEN COALESCE(speciality_count, 0) + COALESCE(Italian_count, 0) > 0
THEN 1
ELSE 0
END AS TwoCount
FROM table_name

