Re: Using Single Query with Group by clause.
From: Paul Ramsteijn <Ramsteijn_at_yahoo.com>
Date: Sat, 21 Dec 2002 17:24:39 +0100
Message-ID: <3E0495C7.DEC97802_at_yahoo.com>
Date: Sat, 21 Dec 2002 17:24:39 +0100
Message-ID: <3E0495C7.DEC97802_at_yahoo.com>
where CUSTOMER_ID = 20
or, for multiple customers in one go:
select CUSTOMER_ID, count(*) openOrders, decode(count(*),
0,0,1,max(order_id), -999999)
from ks_temp
group by CUSTOMER_ID
Paul Ramsteijn.
Srinivas wrote:
> I already have a group function count(*) in the decode. The problem is
> order_id
> in the decode which forces to have a group by and in group by we
> cannot have a group function like count(*)..
> so it is catch 22 situation..
>
> thanks for the response ..
--Received on Sat Dec 21 2002 - 17:24:39 CET