Skip to content

Instantly share code, notes, and snippets.

@williamjacksn
Created August 18, 2011 18:48
Show Gist options
  • Save williamjacksn/1154822 to your computer and use it in GitHub Desktop.
Save williamjacksn/1154822 to your computer and use it in GitHub Desktop.
Rainwave SQL / All albums with number of songs and total song length
select
rw_albums.sid,
album_name,
count(song_id) as num_songs,
sum(song_secondslong) as total_song_length
from
rw_albums
join
rw_songs using (album_id)
where
rw_albums.sid < 5 and
song_verified is true
group by
rw_albums.sid,
album_name
order by
album_name,
rw_albums.sid;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment