Re: Timestamp interval question

Поиск
Список
Период
Сортировка
От Brent R. Matzelle
Тема Re: Timestamp interval question
Дата
Msg-id 20010314164326.85682.qmail@web13014.mail.yahoo.com
обсуждение исходный текст
Ответ на Timestamp interval question  (Aaron Cline <acline@okstateREMOVECAPS.edu>)
Список 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 по дате отправления:

Предыдущее
От: "Daniel A. Melo"
Дата:
Сообщение: Re: Re: compilation error
Следующее
От: "David Wall"
Дата:
Сообщение: Re: Binary Large Data on Postgres