SQL按日期统计数据

SELECT SUM(basicPrice) AS TotalBasicPrice,SUM(memberPrice) AS TotalMemberPrice,SUM(cfScore) AS TotalCfScore,COUNT(1) AS ProductCount,DATEPART(YEAR, inputTime) AS YearTime,DATEPART(month, inputTime) AS MonthTime FROM Pro_cf_Product GROUP BY DATEPART(YEAR, inputTime),DATEPART(MONTH, inputTime)

原文地址:https://www.cnblogs.com/ChengDong/p/2997845.html