Re: search for partial dates - Mailing list pgsql-general

From Tom Lane
Subject Re: search for partial dates
Date
Msg-id 18768.1244752520@sss.pgh.pa.us
Whole thread Raw
In response to search for partial dates  ("James B. Byrne" <byrnejb@harte-lyne.ca>)
Responses Re: search for partial dates
List pgsql-general
"James B. Byrne" <byrnejb@harte-lyne.ca> writes:
> Given a datetime column, not null, is there a single syntax that
> permits searching for all dates in a given year, year+month, and
> year+month+day such that a single parameterised query can handle all
> three circumstances?

Try date_trunc() ... however, if you want the query to be indexable,
it'll take a bit more work.

            regards, tom lane

pgsql-general by date:

Previous
From: Christophe
Date:
Subject: Re: search for partial dates
Next
From: Brandon Metcalf
Date:
Subject: Re: listing relations