Re: Question on interval - Mailing list pgsql-sql

From Steve Crawford
Subject Re: Question on interval
Date
Msg-id 46295D1E.6070809@pinpointresearch.com
Whole thread Raw
In response to Re: Question on interval  ("Rodrigo De León" <rdeleonp@gmail.com>)
List pgsql-sql
Rodrigo De León wrote:
> On 4/20/07, Wei Weng <wweng@kencast.com> wrote:
>> Hi all.
>>
>> How do I write a query that converts an interger to the interval type?
>>
>> Like convert integer 10 to INTERVAL '10 seconds'?
>>
>> The integer is a column in a table though, so it is more like convert
>> integer tbl.theInteger to INTERVAL 'tbl.theInteger seconds".
>>
>> Thanks!
>>
>>
>> Wei
>
> select (10||' sec')::interval;

Or, if you prefer:
select 10*'1 second'::interval;

Cheers,
Steve



pgsql-sql by date:

Previous
From: Scott Marlowe
Date:
Subject: Re: Question on interval
Next
From: "Aaron Bono"
Date:
Subject: Split String Into Multiple Records