forked from brmlab/brmbar-github
Schema 0017: fix into syntax
This commit is contained in:
parent
3b0cb6472d
commit
f7f137821b
1 changed files with 4 additions and 2 deletions
|
@ -40,8 +40,10 @@ DECLARE
|
|||
v_crsum NUMERIC;
|
||||
v_dbsum NUMERIC;
|
||||
BEGIN
|
||||
SELECT COALESCE(SUM(CASE WHEN side='credit' THEN amount ELSE 0 END),0) crsum INTO v_crsum,
|
||||
COALESCE(SUM(CASE WHEN side='debit' THEN amount ELSE 0 END),0) dbsum into v_dbsum
|
||||
SELECT
|
||||
COALESCE(SUM(CASE WHEN side='credit' THEN amount ELSE 0 END),0) crsum,
|
||||
COALESCE(SUM(CASE WHEN side='debit' THEN amount ELSE 0 END),0) dbsum
|
||||
INTO v_crsum, v_dbsum
|
||||
FROM public.transaction_splits ts WHERE ts.account=4
|
||||
RETURN v_dbsum - v_crsum;
|
||||
END; $$;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue