Subject | RE: [firebird-support] newbie question |
---|---|
Author | Gert Coetzee |
Post date | 2004-11-17T13:27:09Z |
Thanx I will do so
-----Original Message-----
From: Helen Borrie [mailto:helebor@...]
Sent: Wednesday, November 17, 2004 15:22 PM
To: firebird-support@yahoogroups.com
Subject: Re: [firebird-support] newbie question
At 01:42 PM 17/11/2004 +0100, FSG wrote:
else
include them in the SELECT list; and you should also move the WHERE
criteria into their correct place, because it adds a lot of overhead to
delay the filtering until after the intermediate set is formed:
WHERE DC = 'D'
AND
Account= 'PIT'
GROUP BY MatchingRef, /* DC, Account */
HAVING Sum(Amount) >= 0.01
ORDER BY MatchingRef;
./hb
Yahoo! Groups Links
-----Original Message-----
From: Helen Borrie [mailto:helebor@...]
Sent: Wednesday, November 17, 2004 15:22 PM
To: firebird-support@yahoogroups.com
Subject: Re: [firebird-support] newbie question
At 01:42 PM 17/11/2004 +0100, FSG wrote:
>Gert Coetzee wrote:II will be necessary also to remove the invalid grouping criteria, or
>
> > How would I do this in Firebird ?
>
>You may try sth. like this:
>
> > SELECT MatchingRef AS Ref,
> > Sum(
>
> case
> when (ORIGINAL = '1') then Amount
> else 0
> end
> )
> AS InvAmt,
>
> > Sum(Amount) AS Outstanding,
> > Min(
>
> case
> when (Original ='1') then (cast IDate as
>char(10))
> else 'xxxxxxx'
> end
> )
> AS Date1
>
> > FROM TempCashup
else
include them in the SELECT list; and you should also move the WHERE
criteria into their correct place, because it adds a lot of overhead to
delay the filtering until after the intermediate set is formed:
WHERE DC = 'D'
AND
Account= 'PIT'
GROUP BY MatchingRef, /* DC, Account */
HAVING Sum(Amount) >= 0.01
ORDER BY MatchingRef;
./hb
Yahoo! Groups Links