select count(*) from table
where datediff(year,col,getdate())>=30 and datediff(year,col,gedate())<=40
......`
where datediff(year,col,getdate())>=30 and datediff(year,col,gedate())<=40
......`
解决方案 »
- sql server 不是有效的安装文件夹是怎么回事?
- 通过路由器连接远程SQL SERVER,但是通过ADSL拨号连接远程SQL SERVER可以连上
- 如何查看当前系统下,有多少个数据库实例,实例名是什么?
- SQL语句求助
- 在线急求一sql问题。。。。。。。。。。急啊。。。。谢谢解答!!!!
- 疑难问题,偶太菜鸟不能实现,求高手
- SQL查询这是怎么回事?
- 基础问题,请问用alter怎样给多个列同时转换类型,可以吗?不用一个一个来吧!
- 怎样select数据库中的第80000条记录?(不是前80000条)
- 在SQLSERVER的存储过程中能知道当前计算机的操作系统是什么吗?
- 怎样用sql语句取得数据中的固定条数
- datetime字段中同时存储了日期和时间,有无方法直接提取日期?
RightEdge = 年龄段边界2 select count(*)
from table
where datediff(year,col,getdate())>=LeftEdge
and datediff(year,col,gedate())<=RightEdge
year(time1)-year(time2) + case when (month(time1)*100+day(time1))>=(month(time2)*100+day(time2)) then 0 else -1 end
(year(time2)*10000+month(time2)*100+day(time2)))
/10000
((year(time1)*10000+month(time1)*100+day(time1))-
(year(time2)*10000+month(time2)*100+day(time2)))
/2000