Skip to content

Instantly share code, notes, and snippets.

@sergii
Forked from mgreenly/query.sql
Created June 11, 2021 13:26
Show Gist options
  • Save sergii/dd66ad1211a63e57ea630ea267202207 to your computer and use it in GitHub Desktop.
Save sergii/dd66ad1211a63e57ea630ea267202207 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