I use this to find account balances. I'm not sure if it will help. I use it to find where people coded to accounts that shouldn't have amounts in them, and are not inactive.
SELECT
Sum(debitamt)-Sum(crdtamnt) AS 'Total',
GL00100.ACTNUMBR_1, 'Account Segment1'
GL00100.ACTNUMBR_2, 'Account Segment2'
GL00100.ACTNUMBR_3, 'Account Segment3'
FROM
GL00100, GL20000
WHERE
GL00100.ACTINDX = GL20000.ACTINDX
AND ((GL20000.TRXDATE Between ? And ?))
GROUP BY
GL00100.ACTNUMBR_1,
GL00100.ACTNUMBR_2,
GL00100.ACTNUMBR_3,
GL00100.ACCTTYPE
HAVING
GL00100.ACCTTYPE=1