Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SQL and duplicates
Message
From
07/08/2000 16:35:19
 
 
To
07/08/2000 16:28:46
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00401910
Message ID:
00401925
Views:
18
>>
SELECT field1, COUNT(*) as matchrecs FROM <i>blah</i> GROUP BY field1 HAVING matchrecs > 1 INTO CURSOR <i>foo</i>
>>
>>SELECT * FROM <i>blah</i> WHERE field1 IN (SELECT field1 FROM <i>foo</i>) INTO CURSOR Dups
>
>Ed: Is there an advantage to doing this in two steps rather than one statement such as
>
>SELECT * FROM table WHERE field1 IN (SELECT field1 FROM table GROUP BY field1 HAVING COUNT(*) > 1)
>

It's easier to understand, and doesn't rely on the property COUNT(*) being published, since HAVING acts after the GROUP BY action occurs, and isn't explicitly carried forward in the sub-select.

>Thanks...........Rich
EMail: EdR@edrauh.com
"See, the sun is going down..."
"No, the horizon is moving up!"
- Firesign Theater


NT and Win2K FAQ .. cWashington WSH/ADSI/WMI site
MS WSH site ........... WSH FAQ Site
Wrox Press .............. Win32 Scripting Journal
eSolutions Services, LLC

The Surgeon General has determined that prolonged exposure to the Windows Script Host may be addictive to laboratory mice and codemonkeys
Previous
Reply
Map
View

Click here to load this message in the networking platform