SQL 使用 时间段
--查询七天之内和本周的数据(sqlserver)
select * from tableName where datediff(day,时间字段,getDate())<=7--七天之内
select * from tableName where datediff(day,时间字段,getDate())<=datepart(weekday,getdate())--本周
--查询三天内的数据(sqlserver)
select * from tableName where datediff(dd,时间字段,getDate()) <=2 and datediff(dd,时间字段,getDate())> =0
--查询近一个月的数据(sqlserver)
select * from tableName where datediff(mm,时间字段,getDate())=0