Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@ketanbhatt
Created May 14, 2017 09:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ketanbhatt/5699b09bee5475e3f7dcef5abd128f4b to your computer and use it in GitHub Desktop.
Save ketanbhatt/5699b09bee5475e3f7dcef5abd128f4b to your computer and use it in GitHub Desktop.
Avoid Joins: Join Query
SELECT "purchase"."id"
FROM "purchase"
INNER JOIN "user" ON ("purchase"."user_id" = "user"."id")
WHERE "user"."account_id" IN
(SELECT generate_series(1,1000));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment