Re: partial time stamp query - Mailing list pgsql-general

From Moshe Jacobson
Subject Re: partial time stamp query
Date
Msg-id CAJ4CxLnZ7+mLjOEK7DQvioVFzZxTCLzrndm9O6DdpD0DXvFmqQ@mail.gmail.com
Whole thread Raw
In response to partial time stamp query  (Kirk Wythers <kirk.wythers@gmail.com>)
List pgsql-general
On Mon, Feb 4, 2013 at 9:45 AM, Kirk Wythers <kirk.wythers@gmail.com> wrote=
:

> I am trying to write a query that grabs one particular day from a
> timestamp column. The data are ordered in 15 minute chunks like this:
>
> 2010-07-07 12:45:00
> 2010-07-07 13:00:00
> 2010-07-07 13:15:00
> 2010-07-07 13:30:00
> etc=85
>
> WHERE derived_tsoil_fifteen_min_stacked.time2 =3D '2010-07-07*'
> but that grabs nothing


Just cast the timestamp to a date before you compare it:

WHERE derived_tsoil_fifteen_min_stacked.time2::date =3D '2010-07-07'

--=20
Moshe Jacobson
Nead Werx, Inc. | Manager of Systems Engineering
2323 Cumberland Parkway, Suite 201 | Atlanta, GA 30339
moshe@neadwerx.com | www.neadwerx.com

"People don't multitask because they're good at it. They do it because they
are more distracted" -- David
Sanbonmatsu<http://www.plosone.org/article/info%3Adoi%2F10.1371%2Fjournal.p=
one.0054402>

pgsql-general by date:

Previous
From: Misa Simic
Date:
Subject: Re: partial time stamp query
Next
From: Kirk Wythers
Date:
Subject: Re: partial time stamp query