Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SQL syntax (not familiar)
Message
From
04/08/2003 19:27:36
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivia
 
 
To
04/08/2003 19:12:14
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00816679
Message ID:
00816684
Views:
19
This message has been marked as the solution to the initial question of the thread.
>Hi All,
>
>I'm not very familiar with SQL Syntax. I've been trying to figure out what's wrong with the following statement:
>
>
>SELECT nixies, NixieEng, cnt(*) FROM DBF() ORDER BY nixies GROUP BY nixies
>
>
>The field nixies is a c(30) field and NixieEng is a memo field. FoxPro keeps telling me that the 'GROUP BY clause is missing or invalid'.

The problem is that any field not included in the GROUP BY is ambiguous: from which record of the group should VFP pick a value?

VFP 6 and earlier ignored the problem, and picked some record, almost randomly (actually, the first or the last from the group, I am not sure which - but for practical purposes, this is almost as bad as picking a random value).

VFP 7 (?) and later controls this more strictly. You can go back to the earlier behavior with SET ENGINEBEHAVIOR, but beware the potential ambiguity.

>Also, what other SQL type functions are available other than cnt(*)?

max(), min(), avg(), among others.
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform