pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Michael Olivier <michaelo@dnai.com>
To: pgsql-sql@postgresql.org
Cc: michaelo@dnai.com
Subject: timespan question: using value from row in select
Date: Mon, 19 Oct 1998 18:18:12 -0700
Message-ID: <362BE4D4.37DBE055@dnai.com> (raw)

Hi folks,

I'm trying to write a SELECT statement that uses a min_age column
(integer expressing a number of years) as part of a timespan:

select * from users U where 
   age('now', '01-01-1970') >= timespan('U.min_age years'::timespan);
                                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^

ERROR:  parser: parse error at or near "error"


Is there some way to do this? I want to convert an int expressing years
into a timespan, within a select statement.

Thanks for any insights on how to do this.

--Michael



view thread (2+ messages)  latest in thread

Message-ID: <362BE4D4.37DBE055@dnai.com>
Permalink:  ../362BE4D4.37DBE055@dnai.com/
Also on:    postgresql.org/message-id/362BE4D4.37DBE055@dnai.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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-sql@postgresql.org
  Cc: michaelo@dnai.com
  Subject: Re: timespan question: using value from row in select
  In-Reply-To: <362BE4D4.37DBE055@dnai.com>
  References: <362BE4D4.37DBE055@dnai.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