Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Name
- ----
- John
- Doe
- Mary
- Anon
- Name | Artist | # of Tracks
- -------------------------------------
- Alb1 John 2
- Alb2 John 1
- Alb1 Doe 1
- Album | Artist | Number | Title | Time
- -----------------------------------------
- Alb1 John 1 track1 60
- Alb2 John 1 track2 60
- Alb1 Doe 1 track1 60
- Album | Artist | seconds
- --------------------------
- Alb2 John 60
- Alb1 Doe 60
- SELECT distinct(albums.title), albums.artist, sum(tracks.length) as seconds
- FROM albums join tracks on tracks.artist = albums.artist
- WHERE albums.tracks >= tracks.number
- and albums.artist = tracks.artist
- group by albums.title, albums.artist
- WHERE albums.tracks >= tracks.number
Add Comment
Please, Sign In to add comment