I need to create a Query for Trial Balance per G/L Accounts with posting date and G/L Account Code parameter.
My Query:
select
"OACT"."AcctCode" as "G/L Account",
"OACT"."AcctName" as "Name",
null as "Debit",
null as "Credit"
from "OACT"
where "OACT"."AcctCode" in ('51110100','51110200','51110300','51110400','51110500','51110600','51110700','51110800','51110900')
UNION ALL
select
null,
null,
sum("Debit") as "Debit",
sum("Credit") as "Credit"
from "JDT1"
where "JDT1"."Account" in ('51110100','51110200','51110300','51110400','51110500','51110600','51110700','51110800','51110900') and
cast("JDT1"."RefDate" as date) between cast('2020-05-01' as date) and cast('2020-05-31' as date)
I need advice if I'm doing it right, I appreciate the support.