如果你能保证你的查询日期是2007-08即(月份小于10的情况下,会补0) select * from 表名 where convert(char(7),日期字段名,121)='2007-08'不能保证,即出现2007-8时 A: select * from 表名 where year(日期字段名)=2007 and month(日期字段名)=8 此种要分拆一下查询日期值 B: select * from SmsMOMT_8988.dbo.SMS_Submit_Archive where year(sendTime)*10+month(sendTime)=20078 不分拆
如果你能保证你的查询日期是2007-08即(月份小于10的情况下,会补0) select * from 表名 where convert(char(7),日期字段名,121)='2007-08'不能保证,即出现2007-8时 A: select * from 表名 where year(日期字段名)=2007 and month(日期字段名)=8 此种要分拆一下查询日期值 B: select * from 表名 where year(日期字段名)*10+month(日期字段名)=20078 不分拆晕,把俺测试的实际语句弄上来了
select * from 表名 where convert(char(7),日期字段名,121)='2007-08'不能保证,即出现2007-8时
A: select * from 表名 where year(日期字段名)=2007 and month(日期字段名)=8
此种要分拆一下查询日期值
B: select * from SmsMOMT_8988.dbo.SMS_Submit_Archive where year(sendTime)*10+month(sendTime)=20078
不分拆
select * from 表名 where convert(char(7),日期字段名,121)='2007-08'不能保证,即出现2007-8时
A: select * from 表名 where year(日期字段名)=2007 and month(日期字段名)=8
此种要分拆一下查询日期值
B: select * from 表名 where year(日期字段名)*10+month(日期字段名)=20078
不分拆晕,把俺测试的实际语句弄上来了