pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Larry Lennhoff <llennhoff-postgres@pexicom.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: pgsql-sql@postgresql.org
Subject: Re: Create interval using column value?
Date: Sun, 24 Oct 2004 23:18:55 -0400
Message-ID: <6.0.2.0.0.20041024231819.03b5c540@localhost> (raw)
In-Reply-To: <9636.1098673912@sss.pgh.pa.us>
References: <6.0.2.0.0.20041024224504.03b5c7c8@localhost>
	<9636.1098673912@sss.pgh.pa.us>

Thanks, that was exactly what I needed.

Larry

]At 11:11 PM 10/24/2004, Tom Lane wrote:
>Larry Lennhoff <llennhoff-postgres@pexicom.com> writes:
> > What I want to do is find all the rows in
> > A which were built before now() - build_interval seconds ago.  If I could
> > just write this in SQL it would look something like:
>
> > SELECT A.id FROM A JOIN B ON (join_col) WHERE built_on < now() - interval
> > 'build_interval seconds';
>
>You are confused about the difference between a literal constant and an
>expression.   Try something like
>
>.. WHERE built_on < now() - build_interval * interval '1 second';
>
>which relies on the number-times-interval operator.
>
>                         regards, tom lane




view thread (4+ messages)

Message-ID: <6.0.2.0.0.20041024231819.03b5c540@localhost>
Permalink:  ../6.0.2.0.0.20041024231819.03b5c540@localhost/
Also on:    postgresql.org/message-id/6.0.2.0.0.20041024231819.03b5c540@localhost

 · 

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: llennhoff-postgres@pexicom.com, tgl@sss.pgh.pa.us
  Subject: Re: Create interval using column value?
  In-Reply-To: <6.0.2.0.0.20041024231819.03b5c540@localhost>

* 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