Re: problem with selects based on dates

Поиск
Список
Период
Сортировка
От J.H.M. Dassen (Ray)
Тема Re: problem with selects based on dates
Дата
Msg-id slrn9peeoq.u6.jdassen@odin.cistron-office.nl
обсуждение исходный текст
Ответ на problem with selects based on dates  (Mike Withers <M.withers@uws.edu.au>)
Список pgsql-general
Mike Withers <M.withers@uws.edu.au> wrote:
> db2001=# SELECT * FROM emp WHERE hiredate > 1981-01-01;
                                              ^^^^^^^^^^

> It is not clear to me why in the last query the 1980-12-17 hiredate record
> is selected as well.

There are no quotes around what you intend to be the date. Thus it is
evaluated as an expression, resulting in 1979. Try
    SELECT * FROM emp WHERE hiredate > '1981-01-01';

HTH,
Ray
--
sendmail.cf does not resemble line noise.  It resembles the result of
somebody banging his head on the keyboard.  Anybody who has worked with it
will understand why.
    Seth Breidbart in <8db6uj$67j$1@panix2.panix.com>

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

Предыдущее
От: Martijn van Oosterhout
Дата:
Сообщение: Re: problem with selects based on dates
Следующее
От: "Colin 't Hart"
Дата:
Сообщение: Re: PHP performance problems with postgres