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:
[php]SELECT CONCAT(FirstName, LastName) as Vitals FROM STUDENTS[/php]
Vitals for both is null, as there is a single null field. How do you overcome this behaviour?
[php]IFNULL(Firstname, ‘<BlankValue>’) — In MySQL[/php]
[php]CONCAT(IFNULL(FirstName,”),IFNULL(LastName,”)) — In MySQL[/php]
would return the same thing without the null issue (and a blank string where nulls should be).