I am trying to get three columns as a string but for some reason I only get NULL.
this is the code:
SELECT CONCAT(name, ' ', city, ' ', country) FROM places
the table places contains the three columns name, city and country and it is not empty, however, it can contain NULL in some of the columns.
The result:
NULL
NULL
NULL,
etc
I tried the answer from this post MySQL CONCAT returns NULL if any field contain NULL and it doesn't work for me.
Can you try with CONCAT_WS()
SELECT CONCAT_WS(' ', name, city, country) FROM places