Skip to content

Commit

Permalink
Update sql query
Browse files Browse the repository at this point in the history
  • Loading branch information
azizbekxm committed Nov 21, 2024
1 parent 1a3955f commit 4f0bc79
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,14 @@ WITH aggregated_amounts AS (
)
UPDATE ${myuniversity}_${mymodule}.transaction AS encumbrance
SET
jsonb = jsonb || jsonb_build_object(
'encumbrance', jsonb_build_object(
'amountExpended', to_jsonb(aggregated_amounts.total_expended),
'amountCredited', to_jsonb(aggregated_amounts.total_credited)
)
jsonb = jsonb_set(
jsonb_set(
encumbrance.jsonb,
'{encumbrance,amountExpended}',
to_jsonb(aggregated_amounts.total_expended)
),
'{encumbrance,amountCredited}',
to_jsonb(aggregated_amounts.total_credited)
)
FROM aggregated_amounts
WHERE encumbrance.id = aggregated_amounts.encumbrance_id;

0 comments on commit 4f0bc79

Please sign in to comment.