Skip to content

Instantly share code, notes, and snippets.

@mgreenly
Created December 16, 2014 21:17
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save mgreenly/35fd943fedd7bea800d3 to your computer and use it in GitHub Desktop.
Save mgreenly/35fd943fedd7bea800d3 to your computer and use it in GitHub Desktop.
select
*
from
tables
join (
select table_id
from books
where rating = 1
) as t1 on t1.table_id = tables.table_id
join (
select table_id
from books
where rating = 5
) as t2 on t2.table_id = tables.table_id
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment