RE: TODAY and CURRENT?

From: "Francis Solomon" <francis(at)stellison(dot)co(dot)uk>
To: "Raymond Chui" <raymond(dot)chui(at)noaa(dot)gov>, <pgsql-general(at)postgresql(dot)org>
Subject: RE: TODAY and CURRENT?
Date: 2000-12-19 19:55:54
Message-ID: NEBBIFFPELJMCJAODNPKIECDCEAA.francis@stellison.co.uk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi Raymond,

You might try something like this:

DELETE FROM tablename WHERE datetime < ('now'::timestamp - '10
days'::interval);
and
DELETE FROM tablename WHERE datetime BETWEEN ('now'::timestamp - '10
hours'::interval) AND 'now'::timestamp;

If you just want the date stamp, you can use 'now'::date instead of your
TODAY.
If you want date-and-time stamp, use 'now'::timestamp - this would match
your idea of CURRENT.

Hope this helps

Francis Solomon

>
> I have a table with columns
>
> datetime timestamp,
> value float(8)
>
> I want to delete rows 10 days older or 10 hours older by
>
> delete from tablename where datetime < TODAY-10;
> or
> delete from tablename where datetime between CURRENT-10 and CURRENT;
>
> So are there key words TODAY, CURRENT in PostgreSQL?
>
> Thank you!
>

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Marc SCHAEFER 2000-12-19 20:02:47 Re: Help me for "DBI->connect failed: Sorry, too many clients already."
Previous Message Martin A. Marques 2000-12-19 19:32:44 logs