Article View: borland.public.interbase.sql
Article #954Re: actual(Date1) - next(Date2)
From: Quinn Wildman (CodeGear Develope...
Date: Thu, 22 Mar 2007 15:43
Date: Thu, 22 Mar 2007 15:43
40 lines
2755 bytes
2755 bytes
Sorry, didn't quite grasp the question here. A calculated field can only calculate based on values in the current row. You'll definitely need a stored procedure here. aleplgr wrote: > "Quinn Wildman (CodeGear Developer Support)" <qwildman@nospam.codegear.com> wrote: >> Assuming you have InterBase 7.5 or 2007, created a calculated field >> using case, then order by that field. With earlier versions of InterBase >> you'll need a stored procedure that returns a results set and you can >> order on what it returns. >> >> aleplgr wrote: >>> asdfa >>> I have one 3 field's table: ClientID, Date1 and Date2, first I need to order it by ClientID and for each ClientID order by Date1, then: >>> I have to return a table with each CliendID and if the difference between the actual Date1 and next(Date2) >30 return actual Date1 else if there is no such difference >30 return the greatest Date1 for the actual ClientID. >>> >>> next(Date2) is the Date2 that is in the next row of the actual ClientID >>> I can create auxiliar tables for storing intermmediate results and I'm using EMS SQL Manager 2005, but don't know how to deal with this, any hint please >>> >> -- >> CREATE DOMAIN NEW_COMPANY AS CHAR(8) DEFAULT 'CODEGEAR' CHECK (VALUE <> >> 'BORLAND') NOT NULL; > > > Yes, I have InterBase 7.5, I don't understand the first part of your answer: "create a calculated field using case" > is it possible to calculate the differences between the actual and the next row in a case? is there an example of that? > Thanks again > > > > > > > > > -- CREATE DOMAIN NEW_COMPANY AS CHAR(8) DEFAULT 'CODEGEAR' CHECK (VALUE <> 'BORLAND') NOT NULL;
Technical Details
Message-ID:
<4602a407$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!border1.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!newspeer1.nwr.nac.net!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mailReferences:
<4601ab4c$1@newsgroups.borland.com> <4601ade7@newsgroups.borland.com> <46025249$1@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 114a0e,dd90eb1b1157ce03 X-Google-Attributes: gid114a0e,public X-Google-Language: ENGLISH,ASCII-7-bit Date: Thu, 22 Mar 2007 08:43:02 -0700 From: "Quinn Wildman (CodeGear Developer Support)" <qwildman@nospam.codegear.com> User-Agent: Thunderbird 1.5.0.10 (Windows/20070221) MIME-Version: 1.0 Newsgroups: borland.public.interbase.sql Subject: Re: actual(Date1) - next(Date2) References: <4601ab4c$1@newsgroups.borland.com> <4601ade7@newsgroups.borland.com> <46025249$1@newsgroups.borland.com> In-Reply-To: <46025249$1@newsgroups.borland.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit NNTP-Posting-Host: 10.143.19.108 Message-ID: <4602a407$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1174578183 10.143.19.108 (22 Mar 2007 08:43:03 -0800) Lines: 40 Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!border1.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!newspeer1.nwr.nac.net!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail