Skip to content

Instantly share code, notes, and snippets.

@midhunkrishna
Created April 27, 2017 06:21
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 midhunkrishna/077984da65c1307ff60a57cc10e0fae5 to your computer and use it in GitHub Desktop.
Save midhunkrishna/077984da65c1307ff60a57cc10e0fae5 to your computer and use it in GitHub Desktop.
SELECT DISTINCT(each_attribute ->> 'reference_number_field')
AS reference_number
FROM deliveries
CROSS JOIN json_array_elements(reference_numbers)
AS each_attribute
WHERE (each_attribute -> 'reference_number_field')
IS NOT NULL
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment