Jump to content

CONCAT_WS and CONCAT help


zohab

Recommended Posts

Hi,

 

I am able to concat 3 fields using following command but if any field is empty or null then I am not getting concate string.

       

        I am getting empty string.

 

SELECT CONCAT(account.phone_country_code,'-',account.phone_city_code,'-',account.phone) AS phone FROM account

 

I try for CONCAT_WS from MYSQL documentation but not able to achibe result.

 

http://dev.mysql.com/doc/refman/5.0/en/string-functions.html#function_concat-ws

 

Any solution for this problem?

 

-Thanks

Link to comment
https://forums.phpfreaks.com/topic/256605-concat_ws-and-concat-help/
Share on other sites

Hi

 

What is the problem you are having with it?

 

SELECT CONCAT_WS('-',account.phone_country_code,account.phone_city_code,account.phone) AS phone 
FROM account

 

Or is it that blank columns are skipped on a row? If so use IFNULL on each column.

 

All the best

 

Keith

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.