Skip to content

Instantly share code, notes, and snippets.

@markgajdosik
Created April 28, 2019 21:52
Show Gist options
  • Save markgajdosik/af92b1fd556a2c3a2c81cbf7813c491d to your computer and use it in GitHub Desktop.
Save markgajdosik/af92b1fd556a2c3a2c81cbf7813c491d to your computer and use it in GitHub Desktop.
CREATE OR REPLACE VIEW "joined_batches_fieldmapperview_290" AS
SELECT T1_1.id AS id,
T1_1.added AS added,
T1_1.updated AS updated,
T1_1.notes AS notes,
T1_1.uid AS uid,
T1_1.relates_to_id AS relates_to_id,
T1_1.role_id AS role_id,
T1_1.row AS row,
T1_1.fields || coalesce(T1_2.fields, '{}'::JSONB) || coalesce(T1_3.fields, '{}'::JSONB) AS fields
FROM "data_record" T1_1 LEFT OUTER JOIN "data_record" T1_2 ON T1_1.fields ->> 'F_114481' = T1_2.fields ->> 'F_113923' LEFT OUTER JOIN "joined_batches_fieldmapperview_290" T1_3 ON T1_1.T1_1__row = T1_3.row
WHERE T1_1."role_id" = 7181 AND T1_2."role_id" = 7179
ORDER BY T1_1."role_id" = 7181 AND T1_2."role_id" = 7179
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment