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: Query Hint

Re: Query Hint

From: ciccio <ciccio_at_ciccio.it>
Date: Mon, 12 Feb 2007 08:16:09 +0100
Message-ID: <45d0143f_1@x-privat.org>


Vince wrote:

>> I have a ORDERS table as follows:
[...]

>> select department, level, count(*) as QUANTITY from orders

> If the number of levels is fixed a rather simple approach would be:
> select department,
> sum(decode(level,1,quantity,0)) as level_1,
> sum(decode(level,2,quantity,0)) as level_2,
> ...
> from orders
> ...
> group by department
>

Yes, but I have to compute also quantity (count(*)) in the same query, i.e. I need to know for each department how many orders are at a certain step, how many at another step and so on.

How can I modify this query in order to achieve this result?

Thanks. Received on Mon Feb 12 2007 - 01:16:09 CST

Original text of this message

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