Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Having Trouble with Group By in VFP 9
Message
From
16/03/2006 16:15:49
 
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
01105032
Message ID:
01105077
Views:
25
I jumped from version 7 to 9 and remember reading about this in 8 but hadn't encountered it.

Thanks

>>I am working with an application written in VFP 6 and keep running into problems with sql statements containing a Group By clause. I haven't found a common denominator. Any ideas?
>>
>>Here is an example cut from the code:
>>
>>
>>SELECT ;
>>     receipt.rec_date,receipt.receipt_no, paidinv.inv_no, ;
>>     receipt.type, receipt.card_no, receipt.exp_date, ;
>>     receipt.amount, receipt.country, receipt.exch_rate ;
>>	WHERE receipt.type $ "AMV" .and. receipt.rec_date = date() ;
>>        FROM receipt ;
>>	INNER JOIN paidinv ON receipt.receipt_no = paidinv.receipt_no ;
>>        Group By Receipt.receipt_no ; 	
>>        ORDER BY type ;
>>	INTO CURSOR dispcred
>>
>>
>>Thanks, Jeffrey
>
>Check SET ENGINEBEHAVIOUR command in HELP. GROUP BY must include all non agregate fields used in your select.
>
>SELECT ;
>     receipt.rec_date,receipt.receipt_no, paidinv.inv_no, ;
>     receipt.type, receipt.card_no, receipt.exp_date, ;
>     receipt.amount, receipt.country, receipt.exch_rate ;
>	WHERE receipt.type $ "AMV" .and. receipt.rec_date = date() ;
>        FROM receipt ;
>	INNER JOIN paidinv ON receipt.receipt_no = paidinv.receipt_no ;
>        Group By Receipt.receipt_no, receipt.rec_date,paidinv.inv_no, ;
>                 receipt.type, receipt.card_no, receipt.exp_date, ;
>                 receipt.amount, receipt.country, receipt.exch_rate ;
>        ORDER BY type ;
>	INTO CURSOR dispcred
>
>You you should use MAX() (or MIN()) on every field you didn't care.
>But for easy change just SET ENGINEBEHAVIOUR 70 in your main program. Than change all selects to match the new criteria and after that remove that line.
Previous
Reply
Map
View

Click here to load this message in the networking platform