日期:2014-05-18  浏览次数:20504 次

如何用sql语句实现下列功能?
select   *   from   a   where   rq> =当前月初日         and   rq <=   当前日

------解决方案--------------------
select * from a where rq> =Convert(Varchar(8), GetDate(),120) + '01 ' and rq <= GetDate()

------解决方案--------------------
select * from a where rq between cast(rtrim(year(rq))+ '- '+rtrim(month(rq))+ '-01 ' as datetime) and getdate()