当前位置: 代码迷 >> Sql Server >> 从2015年10开始查询,如何写
  详细解决方案

从2015年10开始查询,如何写

热度:77   发布时间:2016-04-24 08:50:14.0
从2015年10开始查询,怎么写
数据类型 datetime

比如有2015年全年的数据,我想查询从2015年8月开始至今的数据,应该怎么表达。
------解决思路----------------------

-- 到分秒的话,在时间后写就可以了,如果没有写默认是 00:00:00 
select?*?from?t
?where?cdate?between?'2015-08-01 12:05:13'?and?getdate()


------解决思路----------------------

--try this
select * from t
 where cdate between '2015-07-31 23:59:59'  and  convert(varchar(100),getdate(),120)