Skip to content

Instantly share code, notes, and snippets.

@williamjacksn
Created February 23, 2012 14:06
Show Gist options
  • Save williamjacksn/1893009 to your computer and use it in GitHub Desktop.
Save williamjacksn/1893009 to your computer and use it in GitHub Desktop.
Rainwave SQL / Song history
select
case rw_songs.sid
when 1 then 'Game'
when 2 then 'OCReMix'
when 3 then 'Covers'
when 4 then 'Chiptune'
else 'All'
end as "Channel",
album_id as "Album ID",
album_name as "Album Title",
song_id as "Song ID",
song_title as "Song Title",
timestamp with time zone 'epoch' + sched_starttime * interval '1 second' as "Start Time",
elec_votes as "Votes",
case elec_isrequest
when 0 then 'Conflict'
when 1 then 'Conflict'
when 3 then 'Random Request'
when 4 then 'Queued Request'
else 'Normal'
end as "Song Type"
from
rw_schedule
join
rw_elections using (sched_id)
join
rw_songs using (song_id)
join
rw_albums using (album_id)
where
elec_position = 0 and
sched_used > 0
order by
"Start Time"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment