Re: How to filter on timestamps?

From: Alvaro Herrera <alvherre(at)dcc(dot)uchile(dot)cl>
To: "B(dot)W(dot)H(dot) van Beest" <bwvb(at)xs4all(dot)nl>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: How to filter on timestamps?
Date: 2004-07-08 19:18:55
Message-ID: 20040708191855.GE10089@dcc.uchile.cl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Tue, Jul 06, 2004 at 01:27:29AM +0200, B.W.H. van Beest wrote:

> I have a table where one of the columns is of type 'TIMESTAMP'
>
> How can I do a query to filter on the TIMESTAMP value, e.g. to obtain
> all rows earlier than a certain time stamp?

SELECT ... WHERE timestamp_field < 'certain timestamp';

You may need an explicit cast to timestamp in the constant, like
cast('certain timestamp' as timestamp)

--
Alvaro Herrera (<alvherre[a]dcc.uchile.cl>)
"El día que dejes de cambiar dejarás de vivir"

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Andy B 2004-07-08 19:19:38 Re: Enough RAM for entire Database.. cost aside, is this
Previous Message Jim Rosenberg 2004-07-08 19:17:20 Subtransaction syntax in 7.5??