CONCAT returns NULL if any one field contain NULL value in MySQL: Solved

As per MySQL documentation CONCAT() returns NULL if any argument is NULL.

So, we need to use CONCAT with IFNULL.

For Example

SELECT

  CONCAT( IFNULL(`contact_name`, ''),' ',IFNULL(`last_name`, '')) AS full_name

FROM `users`


Comments

Popular posts from this blog

Creating Protected routes in ReactJS

Stop video playing when Bootstrap modal is closed