Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Return Dupes
Message
 
À
03/05/2012 00:14:09
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:
01543085
Vues:
53
>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
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform