Re: Timestamp interval question - Mailing list pgsql-general

From Brent R. Matzelle
Subject Re: Timestamp interval question
Date
Msg-id 20010314164326.85682.qmail@web13014.mail.yahoo.com
Whole thread Raw
In response to Timestamp interval question  (Aaron Cline <acline@okstateREMOVECAPS.edu>)
List pgsql-general
--- Aaron Cline <acline@okstateREMOVECAPS.edu> wrote:
> Hi:
>
> I'm relatively new here so excuse me if I sound dumb.  I need
> to know if
> (I'm pretty sure it is) it is possible to compare an old
> recorded timestamp
> with the current timestamp and if the old timestamp is say 30
> days old,
> have that entry deleted?

You can do this with a single SQL query so no DBI-specific
coding is necessary:

DELETE FROM table WHERE date_field < (CURRENT_TIMESTAMP -
INTERVAL '30 days')

Brent

__________________________________________________
Do You Yahoo!?
Yahoo! Auctions - Buy the things you want at great prices.
http://auctions.yahoo.com/

pgsql-general by date:

Previous
From: "Daniel A. Melo"
Date:
Subject: Re: Re: compilation error
Next
From: "David Wall"
Date:
Subject: Re: Binary Large Data on Postgres