timespan question: using value from row in select

From: Michael Olivier <michaelo(at)dnai(dot)com>
To: pgsql-sql(at)postgresql(dot)org
Cc: michaelo(at)dnai(dot)com
Subject: timespan question: using value from row in select
Date: 1998-10-20 01:18:12
Message-ID: 362BE4D4.37DBE055@dnai.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

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

Browse pgsql-sql by date

  From Date Subject
Next Message Pascal Forget 1998-10-20 14:01:14 Index on VARCHAR faster than TEXT?
Previous Message Bryan White 1998-10-19 19:37:46 Defaulting to current date