Skip to content

Instantly share code, notes, and snippets.

@zettamax
Created October 3, 2014 10:06
Show Gist options
  • Save zettamax/c3c1c3606851e3416285 to your computer and use it in GitHub Desktop.
Save zettamax/c3c1c3606851e3416285 to your computer and use it in GitHub Desktop.
select * from readers_items r
join items i on i.item_id = r.item_id
left join songs s on s.song_id = i.song_id
left join authors a on a.author_id = s.author_id
where r.reader_id = %reader_id here%
and (a.author_id is null or s.song_id is null)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment