Subject RE: [firebird-support] newbie question
Author Gert Coetzee
Thanx it is working.

-----Original Message-----
From: Frank Schlottmann-Goedde
[mailto:frank.schlottmann-goedde@...]
Sent: Wednesday, November 17, 2004 14:42 PM
To: firebird-support@yahoogroups.com
Subject: Re: [firebird-support] newbie question



Gert Coetzee wrote:

> How would I do this in Firebird ?

You may try sth. like this:

> SELECT TempCashup.MatchingRef AS Ref,
> Sum(

case
when (TempCashup.ORIGINAL = '1') then TempCashup.Amount
else 0
end
)
AS InvAmt,

> Sum(TempCashup.Amount) AS Outstanding,
> Min(

case
when (TempCashup.Original ='1') then (cast TempCashup.IDate as
char(10))
else 'xxxxxxx'
end
)
AS Date1

> FROM TempCashup
> GROUP BY TempCashup.MatchingRef, TempCashup.DC, TempCashup.Account
> HAVING (((Sum(TempCashup.Amount)) >= 0.01) AND ((TempCashup.DC) =
'D')
> AND
> ((TempCashup.Account)= 'PIT' ))
> ORDER BY TempCashup.MatchingRef;



it's untested.


Frank
--
"Fascinating creatures, phoenixes, they can carry immensely heavy loads,
their tears have healing powers and they make highly faithful pets."
- J.K. Rowling





Yahoo! Groups Links