Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
SQL and duplicates
Message
De
07/08/2000 16:28:46
 
 
À
07/08/2000 16:12:26
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00401910
Message ID:
00401921
Vues:
20
>>How would I write a SQL statement to show all duplicate records only, on a field, with no unique records?
>>
>>rec no field1 results => recno field1
>>1 a 1 a
>>2 b 3 a
>>3 a 4 a
>>4 a 6 d
>>5 c 7 d
>>6 d
>>7 d
>>
>
>
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)

Thanks...........Rich
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform