Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Site Related Forums
 Article Discussion
 delete top

Author  Topic 

esthera
Master Smack Fu Yak Hacker

1410 Posts

Posted - 2005-04-03 : 11:55:00
what's wrong with this statement and how would I do it:

delete top 193 from users where pdupeid=311 order by myid desc

rockmoose
SQL Natt Alfen

3279 Posts

Posted - 2005-04-03 : 12:02:03
You can't use TOP and ORDER BY with DELETE.
Try;
DELETE users WHERE myid IN(
SELECT TOP 193 FROM users WHERE pdupeid = 311 ORDER BY myid DESC)

rockmoose
Go to Top of Page
   

- Advertisement -