X-Original-To: pgsql-sql@postgresql.org Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id D0E8B4753A1 for ; Mon, 10 Feb 2003 13:05:19 -0500 (EST) Received: from zero.voxel.net (zero.voxel.net [207.99.115.77]) by postgresql.org (Postfix) with ESMTP id 61F61474E53 for ; Mon, 10 Feb 2003 13:05:19 -0500 (EST) Received: from flowlabs.com (localhost [127.0.0.1]) by zero.voxel.net (Postfix) with SMTP id 49D0324B773 for ; Mon, 10 Feb 2003 13:05:18 -0500 (EST) Received: from 24.136.118.31 (SquirrelMail authenticated user john@flowlabs.com) by zero.voxel.net with HTTP; Mon, 10 Feb 2003 13:05:18 -0500 (EST) Message-ID: <36167.24.136.118.31.1044900318.squirrel@zero.voxel.net> Date: Mon, 10 Feb 2003 13:05:18 -0500 (EST) Subject: problems with date and interval queries. From: To: X-Priority: 3 Importance: Normal X-Mailer: SquirrelMail (version 1.2.10) MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200302/195 X-Sequence-Number: 11593 I am having problems adding an interval to a date in a select statement where the interval is specified as a selected column. Is this possible? Below is an example of the query that I'm executing. The query gives and error at the num_min column in the outer query. It works fine if that is replaced with the text '90 minutes'. Thank you in advance for all help provided. -John select message_id, to_char((now() + ((interval num_min) * (2 ^ (num_fail - (num_fail - fail_count))))),'mon DD YYYY HH24:MI:SS') as abs_send_date, fork_count from ( select message_id, number_reattempt_failures as num_fail, resend_count as fail_count, (to_char(coalesce(minutes_between_reattempt, 90), '999') || ' minutes') as num_min, last_completion_date as last_date, fork_count from pa_mailblast_message where send_state =3D 'sent' and number_reattempt_failures > resend_count) a