Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Delete all but the last
Message
From
12/08/2011 16:48:24
 
 
To
12/08/2011 16:28:17
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 7 SP1
OS:
Windows 7
Network:
Windows 2000 Server
Database:
Visual FoxPro
Application:
Desktop
Miscellaneous
Thread ID:
01520872
Message ID:
01520876
Views:
49
>Hi. I have a database with a lot of duplicates (but it is ok). How can I mark/delete all but the last instance of each entry? Please keep in mind that I am in v.7.
>
>Thanks, Randy

How about
DELETE FROM myTable WHERE keyfield NOT IN (SELECT MAX(keyfield) FROM myTable GROUP BY groupkey)
Previous
Reply
Map
View

Click here to load this message in the networking platform