Re: Lexical question... - Mailing list pgsql-general

From Net Virtual Mailing Lists
Subject Re: Lexical question...
Date
Msg-id 20041123104727.26882@mail.net-virtual.com
Whole thread Raw
In response to Lexical question...  ("Net Virtual Mailing Lists" <mailinglists@net-virtual.com>)
List pgsql-general
Err, I just read my latest digest and saw the solution:

update datafrenzy.jobdata set entered_dt= now() - CAST(round(random()*45)
|| ' days' AS interval);


- Greg

>Hello,
>
>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';
>
>
>Any ideas on the proper way to accomplish this?
>
>Thanks!
>
>- Greg
>



pgsql-general by date:

Previous
From: "Net Virtual Mailing Lists"
Date:
Subject: Re: null value of type java.sql.Time
Next
From: Richard Huxton
Date:
Subject: Re: Bug in queries ??