group_concat(A,\' \',B,\' \',C) as Name,
then using this php for displaying
For MySQL (or plain text) output You could use \n
as a separator:
SELECT GROUP_CONCAT(column1 SEPARATOR '\n') FROM table1;
I use this very often when I need to get many new-line-separated values in one row for other processing.
I don't understand what do you mean by line break between X and Y, but if you need the values to be comma separated you can add any separator to the Group_Concat like that:
group_concat(Name SEPARATOR ' ') as Name
and here is some other separators you can use.
Example
SELECT Name, GROUP_CONCAT(city SEPARATOR '\n') AS city, nb
FROM
(SELECT 'A' AS Name, 'Agra' AS city, 101 AS nb
UNION ALL
SELECT 'B' AS Name, 'Delhi' AS city, 102 AS nb
UNION ALL
SELECT 'A' AS Name, 'Allahabad' AS city, 101 AS nb) AS a
GROUP BY Name, nb;
I figured it out. this is the correct way to add line break as seperator in the browser:
group_concat(A,' ',B,' ',C separator '<br>') as Name,