急:请问要得到这样的记录,SQL语句怎么写? select top 5 col from a order by abs(col-20)或:select top 5 col from a where col<>20 order by abs(col-20) 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 where convert(char(8),getdate(),112) = convert(char(8),字段d,112) select CONVERT(varchar(10), getDate(),120) --不要时间2002-1-1select convert(char(8),getdate(),112) ----20020101select convert(char(8),getdate(),108) ---06:05:05select dateadd(month,-24,'2002-12-14')---------------------^^^减select dateadd(day,-24,'2002-12-14')----------------^^^天或year年select datediff(day,'2001-1-1','2002-1-1') 天select datediff(year,'2001-1-1','2002-1-1') 年select day(getdate()) 天select year(getdate()) 年select month(getdate()) 月 select datediff(day,'2001-1-1','2002-1-1')=0 --就是当天的 SqlServer2000自定义函数中 float转换为字符型问题 存储过程---新手问题 如何进行查询,谢谢 godaddy虚拟主机安装后进入后台报Server Error in '/' Application错误? 多条件统计 更改一项设置,希望大家帮我解答一下,谢谢了! 为何查询分析器不能启动 一个很难的sql语句请教 关于存储过程 用存储过程,如果表里没有记录,怎么控制,不让查询???等待专家指点;; 求救!!!有关存储过程.... 高分相送
select convert(char(8),getdate(),112) ----20020101
select convert(char(8),getdate(),108) ---06:05:05select dateadd(month,-24,'2002-12-14')
---------------------^^^减
select dateadd(day,-24,'2002-12-14')
----------------^^^天或year年select datediff(day,'2001-1-1','2002-1-1') 天
select datediff(year,'2001-1-1','2002-1-1') 年select day(getdate()) 天
select year(getdate()) 年
select month(getdate()) 月