Re: Create interval using column value?

Поиск
Список
Период
Сортировка
Искать
От
Larry Lennhoff
Тема
Re: Create interval using column value?
Дата
Msg-id
6.0.2.0.0.20041024231819.03b5c540@localhost
Ответ на
Список
Дерево обсуждения
Create interval using column value? Larry Lennhoff <llennhoff-postgres@pexicom.com>
Re: Create interval using column value? Tom Lane <tgl@sss.pgh.pa.us>
Re: Create interval using column value? Larry Lennhoff <llennhoff-postgres@pexicom.com>
Re: Create interval using column value? Michael Glaesemann <grzm@myrealbox.com>
Thanks, that was exactly what I needed.

Larry

]At 11:11 PM 10/24/2004, Tom Lane wrote:
>Larry Lennhoff  writes:
> > What I want to do is find all the rows in
> > A which were built before now() - build_interval seconds ago.  If I could
> > just write this in SQL it would look something like:
>
> > SELECT A.id FROM A JOIN B ON (join_col) WHERE built_on < now() - interval
> > 'build_interval seconds';
>
>You are confused about the difference between a literal constant and an
>expression.   Try something like
>
>.. WHERE built_on < now() - build_interval * interval '1 second';
>
>which relies on the number-times-interval operator.
>
>                         regards, tom lane


В списке pgsql-sql по дате отправления
От: Michael Glaesemann
Дата:
От: cristivoinicaru
Дата:
Сообщение: sql
FAQ