Skip to content

Instantly share code, notes, and snippets.

@oleander
Created March 31, 2010 15:54
Show Gist options
  • Select an option

  • Save oleander/350492 to your computer and use it in GitHub Desktop.

Select an option

Save oleander/350492 to your computer and use it in GitHub Desktop.
SELECT SQL_NO_CACHE SQL_BIG_RESULT, MAX(`ChannelsSong`.`time`) as last, `Channel`.`name`, `ChannelsSong`.`id` FROM `channels_songs` AS `ChannelsSong` LEFT JOIN `channels` AS `Channel` ON (`Channel`.`id` = `ChannelsSong`.`channel_id`) LEFT JOIN `songs` AS `Song` ON (`Song`.`id` = `ChannelsSong`.`song_id`) LEFT JOIN `artists` AS `Artist` ON (`Artist`.`id` = `Song`.`artist_id`) WHERE 1 = 1 GROUP BY `ChannelsSong`.`channel_id` ORDER BY `ChannelsSong`.`time` DESC
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment