Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: Nested criteria in a grouping clause
"Jon" <jzuazoa_at_nexo.es> wrote in message news:<a2937t$91f$1_at_unbe.sarenet.es>...
> I would a SELECT FROM a table that contains 3 columns: STATE, CLIENT and
> DEBT and I would like show the rows that contains CLIENT 1, totalizing below
> the details the DEBT column for CLIENT 1; afterwards the same with CLIENT 2;
> finally, due to the fact that all of the clients can be located in a STATE,
> I would to finish the query with the TOTAL of the DEBT for each STATE.
>
> Thanks for you help
Jon,
If you are using Oracle8i, the rollup function can do it.
select state, client, sum(debt)
from t
group by state, rollup(client);
Mike Received on Fri Jan 18 2002 - 15:16:50 CST
![]() |
![]() |