diff --git a/postgres/categories.sql.go b/postgres/categories.sql.go index 2b5d2ce..275e55c 100644 --- a/postgres/categories.sql.go +++ b/postgres/categories.sql.go @@ -133,7 +133,8 @@ SELECT categories.id, categories.name, category_groups.name as group, WHERE categories.id = t_hist.category_id AND t_hist.date < $1 ), 0) )::decimal(12,2) as available, - ( COALESCE(( + ( + COALESCE(( SELECT SUM(a_hist.amount) FROM assignments a_hist WHERE categories.id = a_hist.category_id AND a_hist.date < $2 ), 0)+COALESCE(( diff --git a/postgres/queries/categories.sql b/postgres/queries/categories.sql index 22c4470..555bfe2 100644 --- a/postgres/queries/categories.sql +++ b/postgres/queries/categories.sql @@ -30,7 +30,8 @@ SELECT categories.id, categories.name, category_groups.name as group, WHERE categories.id = t_hist.category_id AND t_hist.date < @to_date ), 0) )::decimal(12,2) as available, - ( COALESCE(( + ( + COALESCE(( SELECT SUM(a_hist.amount) FROM assignments a_hist WHERE categories.id = a_hist.category_id AND a_hist.date < @from_date ), 0)+COALESCE((