Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Return Dupes
Message
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:
01543093
Views:
46
>>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)
If it's not broken, fix it until it is.


My Blog
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform