求sql,删除 最早日期的一条记录,怎么写
select * from table order by time
查出来的 第一条,删除掉
请指教
------解决方案--------------------delete from table where time =(select top 1 time from table order by time )
------解决方案--------------------晕了
delete from table where time in (select min(time) from table)
------解决方案--------------------delete from table where time in
(
select time from
(
select time from table order by time
)
where rownum = 1
)
------解决方案--------------------楼上的兄台,如果time是主键那么你的sql没有问题,可是如果不是呢?
改为下面就可以了:
delete from table where rowid in
(
select rowid from
(
select time from table order by time
)
where rownum = 1
);
楼主问题解决了记得给分啊 。