当前位置: 代码迷 >> Sql Server >> 怎么用sql语句实现下列功能
  详细解决方案

怎么用sql语句实现下列功能

热度:62   发布时间:2016-04-27 16:39:37.0
如何用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()
  相关解决方案