Created
June 22, 2011 18:39
-
-
Save williamjacksn/1040774 to your computer and use it in GitHub Desktop.
Rainwave SQL / High-rated songs and whether they are favourites
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
select | |
rw_songs.sid, | |
album_name, | |
song_title, | |
song_rating, | |
case when f.user_id = 9575 then true else false end as fav | |
from | |
rw_songratings | |
join | |
rw_songs using (song_id) | |
join | |
rw_albums using (album_id) | |
left join ( | |
select | |
* | |
from | |
rw_songfavourites | |
where | |
user_id = 9575 | |
) as f using (song_id) | |
where | |
rw_songratings.user_id = 9575 and | |
song_rating > 4 and | |
song_verified is true | |
order by | |
rw_songs.sid, | |
album_name, | |
song_title; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment