Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SQL Fails in VFP v9.0
Message
From
21/06/2006 13:44:47
 
 
To
21/06/2006 13:40:44
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Environment versions
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Network:
Windows 2000 Server
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01130572
Message ID:
01130575
Views:
15
>This SQL code works in VFP v6.0 but not in v9.0
>
>Select *, Count(*) From assettNavigatorData Group By name Having Count(*) > 1 InTo Cursor duplicateComputerAssignments Order By Name
>
>What am I doing wrong?

You're including fields in the field list that are neither aggregated, not listed in the GROUP BY clause. This is a no-no in SQL, which was added to VFP's version in VFP 8.

The problem is that when a field is neither aggregated nor grouped, VFP has to choose a value at random to put in the result.

To solve your problem, list only the fields you need (instead of *). Then, for fields other than Name, either add them to the GROUP BY clause or, if the value is the same for each record, wrap them with MIN() or MAX().

Tamar
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform