Subject Re: [firebird-support] newbie question
Author Frank Schlottmann-Goedde
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