MySQL returning an empty field: CONCAT(nonEmpty1,empty2,nonEmpty3) = NULL

前端 未结 6 1119
攒了一身酷
攒了一身酷 2021-02-19 10:27

I have PHP 5 code accessing a MyISAM table on MySQL 5 server. The query looks like this:

SELECT CONCAT(fName1,\' \',mName2,\' \',lName3) AS userName 
    FROM us         


        
6条回答
  •  礼貌的吻别
    2021-02-19 11:07

    This was the solution I came up with which included Keeper and Ersatz answer. System would not allow me to vote you guys up though :(

    CONCAT_WS(IFNULL(ts_usr_nameDetails.first_name,''),' ',IFNULL(ts_usr_lib_connectionNameDetails.first_name,'')) AS composerName

    This allowed for some amazing results

提交回复
热议问题