Received: from news.tht.net (news.hub.org [216.126.91.242]) by postgresql.org (8.11.3/8.11.4) with ESMTP id f797WUP19974 for ; Thu, 9 Aug 2001 03:32:35 -0400 (EDT) (envelope-from news@news.tht.net) Received: (from news@localhost) by news.tht.net (8.11.4/8.11.4) id f797H5I35985 for pgsql-sql@postgresql.org; Thu, 9 Aug 2001 03:17:05 -0400 (EDT) (envelope-from news) From: "Graham Coates" X-Newsgroups: comp.databases.postgresql.sql Subject: Re: Adding an INTERVAL to a variable Date: Thu, 9 Aug 2001 16:47:01 +0930 Organization: MindVision Interactive Pty Ltd Lines: 35 Message-ID: <9ktddf$134e$1@news.tht.net> References: <9kg88k$1j30$1@news.tht.net> Reply-To: "Graham Coates" X-Complaints-To: scrappy@hub.org X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4522.1200 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4522.1200 To: pgsql-sql@postgresql.org X-Archive-Number: 200108/138 X-Sequence-Number: 4359 Thanks for the inspiration Vivek! Didn't quite work, but when I made it... dSalesHdrDateDue + (iAcctPayDaysAv || 'Days')::INTERVAL BINGO! it works. Happiness is :-) Graham Coates "Vivek Khera" wrote in message news:x73d737w54.fsf@onceler.kciLink.com... > >>>>> "GC" == Graham Coates writes: > > GC> SELECT Invoices.InvoiceDate + INTERVAL '41 Days' > GC> works fine > GC> but when trying to substitute the number of days with a value form a field > GC> e.g. > > GC> SELECT Invoices.InvoiceDate + INTERVAL Acct.AverageDaysToPay 'Days' > > try > > SELECT Invoices.InvoiceDate + Acct.AverageDaysToPay::interval > > > > -- > =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= > Vivek Khera, Ph.D. Khera Communications, Inc. > Internet: khera@kciLink.com Rockville, MD +1-240-453-8497 > AIM: vivekkhera Y!: vivek_khera http://www.khera.org/~vivek/