日期:2014-05-19  浏览次数:20482 次

日期型数据比较问题:如何得到当前月份的数据?
我有一Ac数据库,日期时间型.
我现在想得到当前月份的所有记录?
该怎么写SQL?
我用的asp.net+c#
谢谢啦!!

------解决方案--------------------
select * from 表 where month(日期字段)=month(now)
------解决方案--------------------
where 字段 between DATEADD(Month, -1, getdate()) and getdate()
------解决方案--------------------
select *
from tb
where Format(fld, "yyyy-mm ")= "2007-03 "
------解决方案--------------------
select *
from tb
where Format(fld, "yyyy-mm ")= '2007-03 '
------解决方案--------------------
select * from 表 where month(addDate)=month(getdate()) and year(addDate)=year(getdate())