Re: search for partial dates

Поиск
Список
Период
Сортировка
От Christophe
Тема Re: search for partial dates
Дата
Msg-id 6FFF18D5-00D8-4015-ACA5-9D01F82C3DC9@thebuild.com
обсуждение исходный текст
Ответ на search for partial dates  ("James B. Byrne" <byrnejb@harte-lyne.ca>)
Список pgsql-general
On Jun 11, 2009, at 1:23 PM, James B. Byrne wrote:

> 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?

Well, of course, in a trivial sense:

SELECT * FROM the_table WHERE datetimecolumn >= $1 AND datetimecolumn
<= $2;

The application has to create the appropriate values for the first and
last days of the year or month in this case, but it's a rare language
that doesn't that facility.

В списке pgsql-general по дате отправления:

Предыдущее
От: "James B. Byrne"
Дата:
Сообщение: search for partial dates
Следующее
От: Tom Lane
Дата:
Сообщение: Re: search for partial dates