科目余额截至日期
小于 1 分钟
示例代码
SELECT *
FROM (
SELECT T1.[Account] AS 科目代码, T2.[AcctName] AS 科目名称
, SUM(T1.[SYSDeb]) - SUM(T1.[SYSCred]) AS 本币余额
, 'RMB' AS 本币币种, SUM(T1.[FCDebit]) - SUM(T1.[FCCredit]) AS 外币余额
, T1.[FCCurrency] AS 外币币种
FROM OJDT T0
INNER JOIN JDT1 T1 ON T0.TransId = T1.TransId
INNER JOIN OACT T2 ON T1.Account = T2.AcctCode
WHERE T0.[RefDate] <= [%0]
GROUP BY T1.[Account], T2.[AcctName], T1.[FCCurrency]
) M
WHERE 本币余额 <> '0'
ORDER BY 科目代码