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
Advertisement
Answer
If you are trying to get the the sum of the two columns, you just need ton handle the null values properly.
SELECT COALESCE(speciality_count, 0) + COALESCE(Italian_count, 0) FROM table_name