Skip to content

Instantly share code, notes, and snippets.

@dbryand
Created February 5, 2015 09:44
Show Gist options
  • Save dbryand/17cff141c431c47c0948 to your computer and use it in GitHub Desktop.
Save dbryand/17cff141c431c47c0948 to your computer and use it in GitHub Desktop.
Postgres: Find by email in array of JSON objects
// Inspiration: http://stackoverflow.com/a/19868697/1221591
select
*
from
events,
json_array_elements(events.raw->'attendees') as attendees
where
attendees->>'email' = 'dave@davebryand.com';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment