so I am working on prt 3 of the link . The directions say, “Let’s see the titles of songs that were played by each user!” The directions say how to do it however it lists the user_id and not the actually person’s name.
I wanted to see if I could have it list the first_name, last_name, and every title of each song they have listened to.
My current code --------------
WITH chart1 AS (
ON users.id = plays.user_id
SELECT first_name, last_name, title
ON chart1.song_id = songs.id
ORDER BY first_name
fname | lname | song1
fname | lname | song2
fname | lname | song3
fname2 | lname2 | song1
fname2 | lname2 | song2
fname2 | lname2 | song3
how can I make it return?
fname | lname | song1, song2, song3
fname2 | lname2 | song1, song2, song3
edit: well I found the GROUP_CONCAT() function online and it helps “SELECT GROUP_CONCAT(titles) AS …” however the data is all in 1 column now and I would prefer it to be song1 | song2 | song3|
I think that would make it a bit easier to see the most played song and do other functions later.