I have a table with two fields, FirstName and LastName.
Here’s some dummy data:
FirstName | LastName
NULL | Teles Calado
Rodrigo | NULL
Now, if I do:
SELECT CONCAT(FirstName, LastName) as Vitals FROM STUDENTS
Vitals for both is null, as there is a single null field. How do you overcome this behaviour?
IFNULL(Firstname, '<BlankValue>') -- In MySQL
CONCAT(IFNULL(FirstName,''),IFNULL(LastName,'')) -- In MySQL
would return the same thing without the null issue (and a blank string where nulls should be).