Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

GROUP_CONCAT multiple fields with a different separator

Is it possible to do something like:

GROUP_CONCAT(user, price SEPARATOR ', ') AS items

The result is John3.99, Mike24.99

What I need is something like:

John - 3.99, Mike - 24.99

Basically use another type of separator for price field.

like image 499
Alko Avatar asked Aug 07 '16 17:08

Alko


1 Answers

GROUP_CONCAT(CONCAT(user, ' - ', price) SEPARATOR ', ') AS items

Or just

GROUP_CONCAT(user, ' - ', price SEPARATOR ', ') AS items
like image 95
Paul Spiegel Avatar answered Oct 02 '22 12:10

Paul Spiegel