Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Return Dupes
Message
 
To
03/05/2012 00:14:09
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
Environment versions
Visual FoxPro:
VFP 5
OS:
Windows 7
Miscellaneous
Thread ID:
01543083
Message ID:
01543085
Views:
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
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform