日期:2014-05-19  浏览次数:20738 次

删除语句里的order by怎么用
要删除表里最早的3条记录怎么写?
mysql里可以用delete   from   table1   where   xxx=1   order   by   ctime   desc   limit   3
sql   server里面怎么写?

------解决方案--------------------
--try

delete from table1
where xxx=1 and ctime in
(select top 3 ctime from table1 where xxx=1 order by ctime desc)
------解决方案--------------------
set rowcount 3
delete from table1
set rowcount 0