I found a difficult with SQL on Delphi, I use ADOconnection and ADOQuery.
Here these Query
With ADOQuery Do
Begin
SQL.Text:='SELECT QUnionSAPiutang.kd_Customer, T_Customer.nama_customer, '
+'CDbl(IIf(IsNull(DSum("SA","QSumSAPiutang","kd_Customer='" & [QUnionSAPiutang].[kd_Customer] & "' AND ' +'Tgl<#1/1/2010# ")),0,DSum("SA","QSumSAPiutang","kd_Customer='" & [QUnionSAPiutang].[kd_Customer] & "' ' +'AND Tgl<#1/1/2010# "))) AS SA1, Sum(QUnionSAPiutang.D) AS Debit, Sum(QUnionSAPiutang.K) AS Kredit, ' +'[SA1]+[Debit]-[Kredit] AS SAkh '
+'FROM QUnionSAPiutang INNER JOIN T_Customer ON '
+'QUnionSAPiutang.kd_Customer = T_Customer.kd_customer '
+'WHERE (((QUnionSAPiutang.Tgl) Between #1/1/2010# And #1/31/2010#)) '
+'GROUP BY QUnionSAPiutang.kd_Customer, T_Customer.nama_customer';
End
That Query Above has an error.... I try to fix, but still have an error. I hope you can help my problem, please fix that Query. I use Ms.Access XP for Database, if I run that Query on Accsess, the error is nothing.
I use three object T_Customer, QUnionSAPiutang, and QSumSAPiutang.
Where the red text is a part of QSumSAPiutang. coz QSumSAPiutang not directly Join with the others, it is call with DSum.
Please help me, Thank you for your time. I hope reply from you soon....