Last active
November 3, 2021 08:28
-
-
Save JuanRamino/8e798dd42bb3b6800fce5ce4cc861c69 to your computer and use it in GitHub Desktop.
sql postgres
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- find in JSON column array | |
select d -> 'data' ->> 'type' as type, * | |
from events e, jsonb_array_elements((e.ev_object -> 'data')::jsonb) as d | |
where d -> 'data' -> 'profile' ->> 'surname' = 'BRANCATI' | |
-- check if a value in JSON solumn exists | |
select * | |
from events e, jsonb_array_elements((e.ev_object -> 'data')::jsonb) as d | |
where (d -> 'data' ->> 'sysRefs') is null | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment