Skip to content
Advertisement

how do i group rows by an id row in group_concat into one row string?

i have table like this

i want to select them group by col3 column to get this result

i used

to get rows like this

but i want to merge them into one string separated by dashes like this

Advertisement

Answer

Try the following, you can use another GROUP_CONCAT. Here is the demo.

Output:

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement