Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

      users.idasuser_id,

     jsonb_extract_path_text (users.jsonb,'active')::booleanBOOLEAN aspatron_status,  ----- this gets the patron status id; note that I have to cast the extract as "boolean"

      CASE

            WHEN jsonb_extract_path_text (users.jsonb,'active')::BOOLEAN = true

...

      depts.jsonb #>> '{}' as dept_id,   ----- this is the shortcut method of displaying the values from the "depts" json object created by the cross join; note that the curly brackets are empty; this is because there is no tag for the values, it's just the values themselves. If there were a tag for the values, the tag name would go in the curly brackets

      ud.nameasdepartment_name,

...

      CROSS JOIN LATERAL  jsonb_array_elements (jsonb_extract_path (users.jsonb,'departments'))

      WITHordinalityAS depts (jsonb)


LEFTJOINfolio_users.departments__tASud   -------- I am joining to the the departments__t table to get the department name

...