pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Scott Marlowe <smarlowe@g2switchworks.com>
To: Wei Weng <wweng@kencast.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: Question on interval
Date: Fri, 20 Apr 2007 15:11:06 -0500
Message-ID: <1177099866.24411.30.camel@state.g2switchworks.com> (raw)
In-Reply-To: <46290C34.9080507@kencast.com>
References: <46290C34.9080507@kencast.com>

On Fri, 2007-04-20 at 13:53, Wei Weng 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".

A lot of the times, it's easiest to multiply it:

select ..... where somedatefield > now() - interval '1 minute' * 5



view thread (5+ messages)  latest in thread

Message-ID: <1177099866.24411.30.camel@state.g2switchworks.com>
Permalink:  ../1177099866.24411.30.camel@state.g2switchworks.com/
Also on:    postgresql.org/message-id/1177099866.24411.30.camel@state.g2switchworks.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: smarlowe@g2switchworks.com, wweng@kencast.com
  Subject: Re: Question on interval
  In-Reply-To: <1177099866.24411.30.camel@state.g2switchworks.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