pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Steve Crawford <scrawford@pinpointresearch.com>
To: Rodrigo De León <rdeleonp@gmail.com>
Cc: pgsql-sql@postgresql.org, Wei Weng <wweng@kencast.com>
Subject: Re: Question on interval
Date: Fri, 20 Apr 2007 17:38:54 -0700
Message-ID: <46295D1E.6070809@pinpointresearch.com> (raw)
In-Reply-To: <a55915760704201229s24b2004fgf0e8c566886fe4af@mail.gmail.com>
References: <46290C34.9080507@kencast.com>
	<a55915760704201229s24b2004fgf0e8c566886fe4af@mail.gmail.com>

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




view thread (5+ messages)

Message-ID: <46295D1E.6070809@pinpointresearch.com>
Permalink:  ../46295D1E.6070809@pinpointresearch.com/
Also on:    postgresql.org/message-id/46295D1E.6070809@pinpointresearch.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: scrawford@pinpointresearch.com, rdeleonp@gmail.com, wweng@kencast.com
  Subject: Re: Question on interval
  In-Reply-To: <46295D1E.6070809@pinpointresearch.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox