SQL join produces one result only
Posted
by
Rami
on Stack Overflow
See other posts from Stack Overflow
or by Rami
Published on 2010-12-25T07:43:02Z
Indexed on
2010/12/25
7:54 UTC
Read the original article
Hit count: 286
Can anyone please tell me why this result is generation only one results? taking in mind that everything is set right and the three tables are populated correctly, i took out the group_concat and it worked but of course with a php undefined index error!
SELECT `songs`.`song_name`, `songs`.`add_date`, `songs`.`song_id`, `songs`.`song_picture`, group_concat(DISTINCT artists.artist_name) as artist_name FROM (`songs`) JOIN `mtm_songs_artists` ON `songs`.`song_id` = `mtm_songs_artists`.`song_id` JOIN `artists` ON `artists`.`artist_id` = `mtm_songs_artists`.`artist_id` ORDER BY `songs`.`song_id` DESC LIMIT 10
so i'm guessing it's something related to group_concat.
best regards,
Rami
© Stack Overflow or respective owner