Re: Comparing dates

Поиск
Список
Период
Сортировка
От Alvaro Herrera
Тема Re: Comparing dates
Дата
Msg-id 20030904022947.GB6418@dcc.uchile.cl
обсуждение исходный текст
Ответ на Comparing dates  ("John Velman" <velman@cox.net>)
Список pgsql-general
On Tue, Sep 02, 2003 at 04:09:00PM -0700, John Velman wrote:
> My date setting is ISO with US conventions, and output from a select
> is in the form yyyy-mm-dd (2002-01-18, for example.
>
> When I do a select such as
>
> SELECT * FROM table WHERE date BETWEEN '2001-12-28' AND '2002-01-28'
>
> It misses the entry with date '2002-01-28'  (which does exist!).

So, your date column is actually a timestamp?  Cast it to date first and
see if it works, e.g.

SELECT * FROM table WHERE date::date BETWEEN '2001-12-28' AND '2002-01-28'

--
Alvaro Herrera (<alvherre[a]dcc.uchile.cl>)
"La principal característica humana es la tontería"
(Augusto Monterroso)

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

Предыдущее
От: Joseph Hepburne Healy
Дата:
Сообщение: Re: What is the good equivalent for ENUM ?
Следующее
От: Martijn van Oosterhout
Дата:
Сообщение: Re: Using oids