Received: from bjke.com (firewall-user@ganymede.bjke.com [144.210.8.38]) by hub.org (8.8.8/8.8.8) with ESMTP id KAA19104 for ; Tue, 20 Oct 1998 10:45:00 -0400 (EDT) (envelope-from djackson@cpsgroup.com) Received: by bjke.com; id JAA11501; Tue, 20 Oct 1998 09:44:52 -0500 (CDT) Received: from cpsmail.cpsgroup.com(144.210.12.11) by gauntlet.bjke.com via smap (4.1) id xmaa10888; Tue, 20 Oct 98 09:44:06 -0500 Received: by cpsmail with Internet Mail Service (5.0.1458.49) id <4KHRJ8J8>; Tue, 20 Oct 1998 09:46:07 -0500 Message-ID: From: "Jackson, DeJuan" To: Michael Olivier , pgsql-sql@postgreSQL.org Subject: RE: [SQL] timespan question: using value from row in select Date: Tue, 20 Oct 1998 09:46:03 -0500 X-Priority: 3 MIME-Version: 1.0 X-Mailer: Internet Mail Service (5.0.1458.49) Content-Type: text/plain > 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); > ^^^^^^^^^^^^^^^^^^^^^^^^^^^ try: SELECT * FROM users U WHERE AGE('now', '1/1/1997') >= (U.min_age::text || ' 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