Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Using the SUM function in VFP 8.0 SQL code
Message
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00888074
Message ID:
00888091
Views:
25
>I get data which looks like the following:
>
>VOUCHER #  INV_AMT  DST_AMT
>76171      606.20   606.20
>76172      301.87   501.87
>76173      667.75   675.50
>77093      706.14   706.14
>
>
>I don't understand why the 1st and 4th records appear in the results. Does anyone understand why this happens based on the following code?
>
>
>SELECT ;
>		APTRXFIL.VOUCHER_NO, ;
>		APTRXFIL.INV_AMT, ;
>		SUM(APTRXDST.DST_AMT) AS DST_AMT ;
>	FROM ;
>		APTRXFIL, ;
>		APTRXDST ;
>	WHERE ;
>		APTRXFIL.VOUCHER_NO = APTRXDST.VOUCHER_NO AND;
>		APTRXFIL.INV_AMT <> SUM(APTRXDST.DST_AMT) ;
>	GROUP BY ;
>		APTRXFIL.VOUCHER_NO, ;
>		APTRXFIL.INV_AMT ;
>	INTO CURSOR tmpAPTransactions
>
Did you try moving the SUM line from the WHERE to the HAVING and changing the references like I had posted?
Fred
Microsoft Visual FoxPro MVP

foxcentral.net
Previous
Reply
Map
View

Click here to load this message in the networking platform