Created
September 20, 2019 13:01
-
-
Save camallen/1a05914731d548cb4e16ab24f5057ddc to your computer and use it in GitHub Desktop.
Query to find all the 1 task workflows with single question only
This file contains 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
select id, tasks --(kv.value -> 'type') | |
from | |
workflows w, | |
jsonb_each(w.tasks) kv | |
WHERE kv.value -> 'type' = '"single"' | |
AND id IN ( | |
select id FROM | |
(SELECT id, (SELECT COUNT(*) FROM jsonb_object_keys(tasks)) as keys FROM workflows)as keys_tuple | |
WHERE keys = 1 | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment