Skip to content

Instantly share code, notes, and snippets.

@prestonp
Last active August 29, 2015 14:08
Show Gist options
  • Save prestonp/9ed46564b95180c8837d to your computer and use it in GitHub Desktop.
Save prestonp/9ed46564b95180c8837d to your computer and use it in GitHub Desktop.
check if a row exists

Postgres exists(EXPRESSION) so useful

select *, exists(select 1 from order_amenities where order_id = 4275) as checked from amenities where restaurant_id = 187;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment