select bd_accid.accidcode,
bd_accid.accidname,
-- fts_voucher_b.interestdate,
-- fts_voucher_b.summary,
--fts_voucher_b.debitamount,
-- fts_voucher_b.creditamount,
sum(fts_voucher_b.creditamount)年归集
from fts_voucher_b, bd_accid
where fts_voucher_b.dr = ''
and fts_voucher_b.pk_corp = ''
and fts_voucher_b.pk_account = bd_accid.pk_accid
-- and bd_accid.accidcode = '011501' --公司
and fts_voucher_b.creditamount <> 0
and substr(fts_voucher_b.interestdate, 1, 4) = '' --年份
and fts_voucher_b.pk_ass not in
(select freevalueid from gl_freevalue where valuecode = '')
group by bd_accid.accidcode,
bd_accid.accidname
order by bd_accid.accidcode