0

I am creating a playlist table. I want to print tracklist from database. I have this sequence of data stored in database.

album | track | singer
----------------------
A     |   1   |  X
A     |   1   |  Y
A     |   2   |  X
A     |   3   |  Z

This way that is if track 1 has sung by both x and y combinely than I have stored that in separate record. But at time of print I want to print in differect style...Like

album | track | singer
----------------------
A     |   1   |  X, Y
A     |   2   |  X
A     |   3   |  Z

What query should I fire to print it in desired schema, that is grouping it according to singer.

0

1 Answer 1

6

Use

select album, track, GROUP_CONCAT(singer) from YourTable group by album, track
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.