Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: Nested criteria in a grouping clause

Re: Nested criteria in a grouping clause

From: Mike Liu <mike2322_at_hotmail.com>
Date: 18 Jan 2002 13:16:50 -0800
Message-ID: <2262aa8e.0201181316.2a965c6f@posting.google.com>


"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

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US