计算数据库中30天以内,30-60天,60-90天,90天以外的数据的个数(用sql实现)
30天以内:select count(*) from TB where datediff(day,字段名,getdate()) between 0 and 30
30-60天:select count(*) from TB where datediff(day,字段名,getdate()) between 30 and 60
60-90天:select count(*) from TB where datediff(day,字段名,getdate()) between 60 and 90
90天以外:select count(*) from TB where datediff(day,字段名,getdate())>90