partial time stamp query

From: Kirk Wythers <kirk(dot)wythers(at)gmail(dot)com>
To: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: partial time stamp query
Date: 2013-02-04 14:45:33
Message-ID: C8A14307-6723-4F5F-A31A-4012BE1455B2@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

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…

If I wanted all records from july 7th 2010, I would expect 4 x 24 = 96 records per day.

I have tried the '=' operator, like this

WHERE derived_tsoil_fifteen_min_stacked.time2 = '2010-07-07*'

but that grabs nothing, and using the '~' operator grabs everything with a 2010 or 07 in it… in other words all days from July of 2010.

Any suggestions would be much appreciated.

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Alexander Farber 2013-02-04 14:45:40 Re: Adding PRIMARY KEY: Table contains duplicated values
Previous Message Adrian Klaver 2013-02-04 14:39:24 Re: [JDBC] JDBC connection test with SSL on PG 9.2.1 server