Skip to content

Instantly share code, notes, and snippets.

@mikeifomin
Created December 10, 2018 13:06
Show Gist options
  • Save mikeifomin/95dd757d8ccab8f43619350f6b0247a7 to your computer and use it in GitHub Desktop.
Save mikeifomin/95dd757d8ccab8f43619350f6b0247a7 to your computer and use it in GitHub Desktop.
Postgres select IN order (great for GraphQL loaders)
SELECT * FROM tbl WHERE id = ANY($1) ORDER BY array_position($1, id);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment