| Oracle FAQ | Your Portal to the Oracle Knowledge Grid | |
Home -> Community -> Usenet -> c.d.o.server -> Re: Tough Analytical SQL Question
michaelw436_at_gmail.com wrote:
> On Aug 10, 11:56 am, DA Morgan <damor..._at_psoug.org> wrote: >> michaelw436.s..._at_gmail.com wrote:
>>>> = to_date('01-aug-2007','DD-MON-YYYY') - 7
>>> and ctype_id =
>>> 'ECHO'
>>> AND order_type IN
>>> ('O')
>>> AND ostatus <>
>>> 'X'
>>> AND cd.cust_id =
>>> o.cust_id
>>> AND cd.is_guest =
>>> 0))
>>> WHERE order_date >= to_date('01-aug-2007','DD-MON-
>>> YYYY')>> Add the integer 1 to your inner query and then sum the integers. >> -- >> Daniel A. Morgan >> University of Washington >> damor..._at_x.washington.edu (replace x with u to respond) >> Puget Sound Oracle Users Groupwww.psoug.org > > I like the idea, but I still get the same results because when I sum > the integer column that I create, I am still adding 1 for each day in > the the 7 day range. I only want to count the distinct cust_id's > inside of that 7 day range. Does that make sense?
Then add it after doing the grouping.
-- Daniel A. Morgan University of Washington damorgan_at_x.washington.edu (replace x with u to respond) Puget Sound Oracle Users Group www.psoug.orgReceived on Fri Aug 10 2007 - 11:21:13 CDT
![]() |
![]() |