Posted by othellomy on 01/19/07 06:19
I think this violates some of the basic principles of relational model
(not sure which ones). However I would love to see some sort of
solution to this problem though. There is some type of process to break
this into normal table with right groupings.
mouac01@yahoo.com wrote:
> 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]
|