🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.interbase.sql
Article #950

Re: actual(Date1) - next(Date2)

#950
From: aleplgr
Date: Thu, 22 Mar 2007 10:54
24 lines
2290 bytes
"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
Technical Details
Message-ID: <46025249$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!nx02.iad01.newshosting.com!newshosting.com!newsfeed.news2me.com!newsfeed.media.kyoto-u.ac.jp!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail
References: <4601ab4c$1@newsgroups.borland.com> <4601ade7@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
From: "aleplgr" <aleplgr@yahoo.es>
Sender: "aleplgr" <aleplgr@yahoo.es>
Reply-To: "aleplgr" <aleplgr@yahoo.es>
Subject: Re: actual(Date1) - next(Date2) 
Newsgroups: borland.public.interbase.sql
X-User-Info: 80.58.205.38     
X-Forwarded-For: 80.25.195.180, 192.168.1.55
References: <4601ab4c$1@newsgroups.borland.com> <4601ade7@newsgroups.borland.com>
NNTP-Posting-Host: 207.105.83.66
Message-ID: <46025249$1@newsgroups.borland.com>
Date: 22 Mar 2007 02:54:17 -0800
X-Trace: newsgroups.borland.com 1174557257 207.105.83.66 (22 Mar 2007 02:54:17 -0800)
Lines: 33
Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!nx02.iad01.newshosting.com!newshosting.com!newsfeed.news2me.com!newsfeed.media.kyoto-u.ac.jp!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail