Skip to content

Instantly share code, notes, and snippets.

@rcmoret
Created May 21, 2019 02:05
Show Gist options
  • Save rcmoret/1d6e57abbdf945952871778676b0d129 to your computer and use it in GitHub Desktop.
Save rcmoret/1d6e57abbdf945952871778676b0d129 to your computer and use it in GitHub Desktop.
select t.*, (select json_group_array(json_object('id', s.id, 'amount', s.amount))) from transactions t join transactions s on s.primary_transaction_id = t.id where t.id = 2;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment