Skip to content

Instantly share code, notes, and snippets.

@williamjacksn
Created February 23, 2012 13:34
Show Gist options
  • Save williamjacksn/1892862 to your computer and use it in GitHub Desktop.
Save williamjacksn/1892862 to your computer and use it in GitHub Desktop.
Rainwave SQL / All songs with cooldown group
select
min(rw_songs.sid) as "Channel ID",
min(album_id) as "Album ID",
min(album_name) as "Album Title",
song_id as "Song ID",
min(song_title) as "Song Title",
array_agg(artist_name) as "Artist",
oac_name as "Cooldown Group",
min(song_rating_avg) as "Average Rating",
timestamp with time zone 'epoch' + min(song_addedon) * interval '1 second' as "Song Added On"
from
rw_songs
join
rw_albums using (album_id)
join
rw_song_artist using (song_id)
join
rw_artists using (artist_id)
left join
rw_song_oa_cat using (song_id)
left join
rw_oa_categories using (oac_id)
where
song_verified is true
group by
song_id,
oac_name
order by
"Channel ID",
"Album Title",
song_id,
"Song Title";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment