本文介绍了每月总销售额的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如果您有一个带有 SALES {Customer_ID, Price, SmallDateTime date}
的表格.您如何报告每月的所有销售额?
If you have a table with SALES {Customer_ID, Price, SmallDateTime date}
. How do you report all sales per month?
SELECT Sum(Price) As Total Sales FROM SALES Group By What Having What
推荐答案
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)
这篇关于每月总销售额的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!