Sunday, August 11, 2019

CONCAT_WS magic concat in mysql

16
If you want to skip NULL values (but not empty strings), you can use CONCAT_WS() function:
CONCAT_WS( ', ',            -- Separator
           CONCAT_WS(' ', tadd.street_number, tadd.street_name),
           tadd.apt_number,  tadd.city, 
           tadd.postal_code, tadd.country
         ) AS Address

No comments:

Post a Comment