Posted by mouac01 on 01/18/07 18:53
I want to sum up the amt field where the acct or group is A1000. Since
A1110 belongs to group A1100, and A1100 belongs to group A1000 it
should pick those amts up as well. The total should be 600. I have
the sql below but I can't figure how to pick up acct A1110 since it
should be rolling up to A1000 because of A1100.
select sum(amt) from tbl_bal
where acct='A1000' or group='A1000';
tbl_bal
acct group amt
A1000 A1000 100
A1100 A1000 200
A1110 A1100 300
[Back to original message]
|