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

Home -> Community -> Usenet -> c.d.o.misc -> Re: Question about SQL Query

Re: Question about SQL Query

From: Michel Cadot <micadot{at}altern{dot}org>
Date: Wed, 14 Dec 2005 18:46:40 +0100
Message-ID: <43a05a7f$0$14565$626a14ce@news.free.fr>

"nickli" <ningli2000_at_hotmail.com> a écrit dans le message de news: 1134517017.107449.295790_at_g14g2000cwa.googlegroups.com...
| Hi,
|
| I was able to solve the following problem using PL/SQL. However I
| would like to know if it can be solved using a SQL query:
|
| The table has these columns: user_id, purchase_date
| I would like to count the number of store visits by a person
| within a calendar year. Purchase_dates within a rolling 7 day period
| are counted as one store visit. There can be several or no purchases
| within these 7 days. Next purchase date can start any time. For
| example:
|
| Purchase_Date: 11/1/2005, 11/3/2005, 11/11/2005, 12/1/2005,
| 12/5/2005, 12/18/2005
| Number of Visits = 4
| 11/1/2005 and 11/3/2005 count as one visit
| 11/11/2005 counts as one visit
| 12/1/2005 and 12/5/2005 count as one visit
| 12/18/2005 counts as one visit
|
| Thanks in advance.
|
| Nick Li
|

What should be the result if there was a visit at 11/08/2005 or 11/09/2005?

Regards
Michel Cadot Received on Wed Dec 14 2005 - 11:46:40 CST

Original text of this message

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