General information
Category:
Databases,Tables, Views, Indexing and SQL syntax
Environment versions
Network:
Windows 2000 Server
>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
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only