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 4914b23 commit 1f488cd
Showing 1 changed file with 5 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,11 @@ WITH aggregated_amounts AS (
)
UPDATE ${myuniversity}_${mymodule}.transaction AS encumbrance
SET
jsonb = jsonb_set(
jsonb_set(
encumbrance.jsonb,
'{encumbrance,amountExpended}',
to_jsonb(aggregated_amounts.total_expended)
),
'{encumbrance,amountCredited}',
to_jsonb(aggregated_amounts.total_credited)
jsonb = jsonb || jsonb_build_object(
'encumbrance', jsonb_build_object(
'amountExpended', to_jsonb(aggregated_amounts.total_expended),
'amountCredited', to_jsonb(aggregated_amounts.total_credited)
)
)
FROM aggregated_amounts
WHERE encumbrance.id = aggregated_amounts.encumbrance_id;

0 comments on commit 1f488cd

Please sign in to comment.