SELECT Primary Key, CNT(*) AS NumOccurs FROM ACCOUNTS ;
GROUP BY Primary Key ;
HAVING NumOccurs > 1 ;
INTO CURSOR temp
* Temp now contains the Primary keys of all dups
SELECT * FROM ACCOUNTS ;
WHERE Primary Key IN (SELECT Primary Key FROM temp) ;
ORDER BY Primary Key
* The results are all duplicated records
If Primary Key is an expression, you'll probably want to name it with an AS clause in the first SELECT, and then reference that name in the subquery in the second SELECT.
>Any suggestions or comments will be welcome, thank you.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