create table tb(time datetime)
insert into tb select '2010-10-25 22:10:30' union all select '2010-11-03 15:20:00' union all select '2010-12-15 11:11:11'
go
select * from tb a where abs(datediff(s,getdate(),time))=(select min(abs(datediff(s,getdate(),time))) from tb)
go
drop table tb
/*
time
-----------------------
2010-11-03 15:20:00.000

(1 行受影响)
*/

 

文章来源:http://blog.csdn.net/hello926/archive/2010/11/20/6023382.aspx

posted on 2011-05-11 11:30  qqhepp  阅读(320)  评论(0编辑  收藏  举报