Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save williamjacksn/1040774 to your computer and use it in GitHub Desktop.
Save williamjacksn/1040774 to your computer and use it in GitHub Desktop.
Rainwave SQL / High-rated songs and whether they are favourites
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