+ -
当前位置:首页 → 问答吧 → 如何获取今天为止过去30天的数据

如何获取今天为止过去30天的数据

时间:2011-11-26

来源:互联网

如题。。。。。就是30天以前的数据不要了,只要搜索今天为止过去30天的数据。。。怎么写呢?

作者: abcjun1   发布时间: 2011-11-26

SQL code
where 日期字段>convert(varchar(10),getdate()-30,120)

作者: Beirut   发布时间: 2011-11-26

SQL code

where datediff(dd,[日期列],getdate()) <= 30

作者: AcHerat   发布时间: 2011-11-26

SQL code

select * from tb where dt between convert(varchar(10),dateadd(dd,-30,getdate()),120) and convert(varchar(10),getdate(),120)

作者: pengxuan   发布时间: 2011-11-26

#2楼 正解

作者: lhqdyy9   发布时间: 2011-11-26

热门下载

更多