Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Return Dupes
Message
From
03/05/2012 11:38:51
 
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:
01543116
Views:
50
>>>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.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform