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:
00888144
Views:
34
I think the odd behaviour you are seeing will disappear if you use a having clause rather than a where clause for the sum criteria. I find that where clauses don't do well with criteria that require an aggregate.

Try this:
SELECT ;
		APTRXFIL.VOUCHER_NO, ;
		APTRXFIL.INV_AMT, ;
		SUM(APTRXDST.DST_AMT) AS DST_AMT ;
	FROM ;
		APTRXFIL, ;
		APTRXDST ;
	WHERE ;
		APTRXFIL.VOUCHER_NO = APTRXDST.VOUCHER_NO ;
        HAVING ;
		APTRXFIL.INV_AMT <> SUM(APTRXDST.DST_AMT) ;
	GROUP BY ;
		APTRXFIL.VOUCHER_NO, ;
		APTRXFIL.INV_AMT ;
	INTO CURSOR tmpAPTransactions
Carole Shaw
Fred Hutchinson Cancer Research Center

Eagles may soar, but weasels don't get sucked into jet engines.
Previous
Reply
Map
View

Click here to load this message in the networking platform