Re: date comparisons

Поиск
Список
Период
Сортировка
От Erik Jones
Тема Re: date comparisons
Дата
Msg-id 457EDCD8.1050102@myemma.com
обсуждение исходный текст
Ответ на date comparisons  ("Belinda M. Giardine" <giardine@bio.cse.psu.edu>)
Ответы Re: date comparisons  ("Belinda M. Giardine" <giardine@bio.cse.psu.edu>)
Список pgsql-general
Belinda M. Giardine wrote:
> This should be simple but I am missing something.  I am trying to extract
> all records entered after a given date.  The table has a field
> date_entered which is a timestamp.  In this particular case I am not
> worried about time.
>
> I have tried:
> select id from main_table where
> date_entered > to_timestamp('January 2006', 'Month YYYY');
>
> select id from main_table where
> (to_timestamp('January 2006', 'Month YYYY'), now()) overlaps (date_entered, date_entered);
>
> Both of these return all the rows in the table.  Half of the rows are
> dated 2000-06-22 12:00:00.
>
> PostgreSQL version 8.1.4
>
I think people often make date comparisons too difficult in postgres.

select id
from main_table
where date_entered >= '2006-01-01';

There are built in conversions for formatted date strings.

--
erik jones <erik@myemma.com>
software development
emma(r)


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

Предыдущее
От: Tony Caduto
Дата:
Сообщение: Re: Running initdb from another process
Следующее
От: "Tomi N/A"
Дата:
Сообщение: a question on SQL