Your Rank: 93
I use this SQL select data from sql sever 2008:
select Patient.PatientID, MAX(Cash.CashID)as MaxID, SUM(Cash.Amount) as Balance
from Patient left join Cash
group by Patient.PatientID
when used in FDQuery with local database, it's run correct. when used in DataSnap with FDQuery In server and ClientDataSet in Client , only the maxid field is correct , the balance field is alway be zero .
I see the type of the balance field is FMTBCD(38,2), so I change the type of amount field from numberic(9,2) to money, this SQL can run correct. is that a bug?