Thursday, November 26, 2015

Difference between MySQL GROUP_CONCAT() and CONCAT_WS()


SELECT GROUP_CONCAT(CONCAT_WS(' ', First_name,Last_name)) FROM users ORDER BY user_id ASC;

+------------------------------------------------+
| GROUP_CONCAT(CONCAT_WS(' ', fname,lname))      |
+------------------------------------------------+
| swarm robots,prabhakarq honni,Dillip Nayak,asdasdasd
+------------------------------------------------+
1 row in set (0.03 sec)




SELECT CONCAT_WS(' ', First_name,Last_name) FROM crm_users ORDER BY user_id ASC;



+------------------------------------------------+
| CONCAT_WS(' ', fname,lname)     |
+------------------------------------------------+
|
swarm robots
prabhakarq honni
Dillip Nayak
asdasdasd asdddasd
love love
+------------------------------------------------+


No comments:

Post a Comment