select count(*) as 学生数量 from table where enrollment between '1998-01-01' and '2003-12-30'
而不是
select count(*) as 学生数量 from table where enrollment between '1998' and '2003'
为什么一定要把月,日都带上?
弱弱的问一下,各位大牛不要砸我
select count(*) as 学生数量 from table where enrollment between '1998-01-01' and '2003-12-30'
而不是
select count(*) as 学生数量 from table where enrollment between '1998' and '2003'
为什么一定要把月,日都带上?
弱弱的问一下,各位大牛不要砸我
韩杨 2010-05-28
我觉得是看你表里的日期是怎么定义的类型。。。。
时嬿 2010-05-28
韩杨 2010-05-28
曾晨 2010-05-28
enrollment 你看下这个字段是怎么定义的 不过稍微改下就好了
select count(*) as 学生数量 from table where datepart(year,enrollment) between '1998' and '2003'
金鑫 2010-05-28
看enrollment 字段的类型
时嬿 2010-05-28
哦~~,了解了,看例子的时候它没说明前提,所以看不太懂了,多谢各位
程守标 2010-05-28
学习了~
何斌 2010-06-01
哈哈
袁帅 2010-06-07
要看那个“enrollment”下面允许控制哪些数据的类型 、