我觉得这很常见,是吗?
如果您有一张带有SALES {Customer_ID,Price,SmallDateTime date}的表格.您如何报告每个月的所有销售额?
@H_404_4@SELECT Sum(Price) As Total Sales FROM SALES Group By What Having What谢谢
解决方法
@H_404_4@SELECT YEAR(date) as SalesYear,MONTH(date) as SalesMonth,SUM(Price) AS TotalSales
FROM Sales
GROUP BY YEAR(date),MONTH(date)
ORDER BY YEAR(date),MONTH(date)