13

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.

ekad
  • 14,436
  • 26
  • 44
  • 46
Alko
  • 1,421
  • 5
  • 25
  • 51

2 Answers2

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

Or just

GROUP_CONCAT(user, ' - ', price SEPARATOR ', ') AS items
Paul Spiegel
  • 30,925
  • 5
  • 44
  • 53
0

Try this way

GROUP_CONCAT(
  DISTINCT CONCAT(user,',',Price SEPERATOR) 
  ORDER BY items 
  SEPARATOR ';'
)
R.K123
  • 159
  • 2
  • 9