循环30日的统计 大概格式是 with Date as ( select cast(DATEADD(mm, DATEDIFF(mm,,getdate()), ) as datetime) Date union all from Date < CONVERT(CHAR(),DATEADD(m,,DATEADD(dd,-DAY(GETDATE())+,GETDATE())),) ) select day(a.Date) as day, b.ID, from Date a left join ( se…