ewom2468 ewom2468 - 11 months ago 65
SQL Question

Concat Values In MySQL Query(To Handle Null Values)

I am writing a PHP and MySQL application in which i have to concatenate multiple column values into one single column.I would have used the concat() function,but it does not handle null values,and the concat_ws(),which does not return the result in the output i want.
What i need can be achieved in the Oracle database like this:

Select 'The Surname Is'||last_name from employees;

My Issue is how can i achieve this same result with MySQL..without using the above named functions?



  CONCAT('The Surname Is ', IFNULL(last_name, 'sadly not available'))
FROM `employees`