Click here to Skip to main content
15,881,204 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello There,

I want to delete top 10 records from my access table.
Does anyone tell me query to delete top 10 records in access 2007.

I have tried below -
Delete Top 10 * from FROM Activity_Master;

but I am getting Syntax Error at "Top".

Please help!!!
Posted

Try
SQL
Delete from Activity_master
where ID in (select top 10 ID from activity_master)


(where ID is your id field)
 
Share this answer
 
v3
Comments
Pravinkarne.31 23-Feb-12 12:22pm    
Thank you So Much!!!!!!!!
[no name] 29-Feb-12 8:13am    
My pleasure
cicciospam 17-Mar-17 8:48am    
Always use an Order By with the Top!
Could you try the below code:

SQL
DELETE * FROM Activity_Master
WHERE IDField IN
(SELECT TOP 10 X.IDField
FROM Activity_Master AS X
 
Share this answer
 
Comments
Pravinkarne.31 23-Feb-12 12:22pm    
Thank you So Much!!!!!!!!
This is Delete all ID in top 10 selected but not delete top 10 record
 
Share this answer
 
Comments
CHill60 20-Dec-21 3:31am    
This is not a solution nor is it clear what you mean.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900