Re: Lexical question...

Поиск
Список
Период
Сортировка
От John DeSoi
Тема Re: Lexical question...
Дата
Msg-id 71F80564-3D58-11D9-AAD7-000A95B03262@pgedit.com
обсуждение исходный текст
Ответ на Lexical question...  ("Net Virtual Mailing Lists" <mailinglists@net-virtual.com>)
Ответы Re: Lexical question...  (Michael Fuhr <mike@fuhr.org>)
Список pgsql-general
On Nov 23, 2004, at 5:33 AM, Net Virtual Mailing Lists wrote:

> I have a table with a timestamp column and I want to set this to a
> value
> of now() - a random number of days between 0 and 45 for each row...
> I've
> tried to do this a bunch of different ways and can't figure it out...
> Here is my latest version:
>
>
> update sometable set entered_dt = now() - interval
> round(random()*45)||'
> days';
>

Try

select now() - ((round(random()*45))::text || ' days')::interval;

Best,

John DeSoi, Ph.D.
http://pgedit.com/
Power Tools for PostgreSQL



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

Предыдущее
От: "Joost Kraaijeveld"
Дата:
Сообщение: Re: Bug in queries ??
Следующее
От: Jerry LeVan
Дата:
Сообщение: Will B4->B5 require an Initdb?