Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Return Dupes
Message
De
03/05/2012 11:38:51
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Titre:
Versions des environnements
Visual FoxPro:
VFP 5
OS:
Windows 7
Divers
Thread ID:
01543083
Message ID:
01543116
Vues:
52
>>>Hi All:
>>>
>>>In the following table:
>>>
>>>
>>>33333                Joe
>>>44444                cat
>>>33333                fish
>>>
>>>
>>>What is the SQL syntax to retrieve only those records for which there are dupes, like so:
>>>
>>>
>>>33333                Joe
>>>33333                fish
>>>
>>>
>>>Thanks,
>>>
>>>Yossi
>>
>>
>>SELECT YourTable.*;
>>FROM YourTable;
>>INNER JOIN (SELECT Field1;
>>                   FROM YourTable;
>>            GROUP BY Field1;
>>            HAVING COUNT(*) > 1) Tbl1 ON Tbl1.Field1 = YourTable.Field1
>>
>>
>>
>>UPDATE !!!!
>>Sorry I didn't saw your versions on VFP.
>>In VFP5:
>>
>>SELECT Field1;
>>FROM YourTable;
>>GROUP BY Field1;
>>HAVING COUNT(*) > 1;
>>INTO CURSOR Tbl1
>>
>>SELECT YourTable.*;
>>FROM YourTable;
>>INNER JOIN  Tbl1 ON Tbl1.Field1 = YourTable.Field1
>>
>
>Will this version work in VFP5?
>
>select * from YourTable where Field1 in (select Field1 from YourTable GROUP BY Field1 having count(*)>1)
It worked!! Thanks.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform