Re: PL/SQL script to clean a table

From: Daniel Morgan <damorgan_at_exesolutions.com>
Date: Wed, 24 Apr 2002 14:52:09 GMT
Message-ID: <3CC6C688.5A829353_at_exesolutions.com>


Do you really want to do what you indicate in step 2? Delete current records and keep the old ones? This conflicts with your example below. And I wouldn't want to send you code that makes a mistake by assuming which of your examples is correct. I doubt anyone else would want to to that either.

Daniel Morgan

Caroline wrote:

> HI all,
> I have a table with so many entries every day so I want to clean it.
>
> table name : service
> table attributes : code, location, date
>
> the goal is to delete each records where :
>
> 1) I can find the same code AND location
> 2) date > one month ago
>
> BUT : I have to keep the last record with this code and location
> before one month.
>
> example:
> 1)code=1 location=a date=20/04/02
> 2)code=1 location=a date=20/03/02
> 3)code=1 location=a date=21/03/02
>
> *I keep the record 1) beacuse the date < one month
> *I keep the 3) and I delete the 2) record because code and location
> are the same, date > one month
> and 3.date > 1.date
>
> And I don't know how to do that ...
>
> Many thanks
>
> Caroline
Received on Wed Apr 24 2002 - 16:52:09 CEST

Original text of this message