如何制作按月分组的年度报告?
我使用下面的查询按月列出交易数量。有谁知道我怎样才能按年份列出。这意味着查询返回我全年除当月之外的所有交易。
也就是说,如果今天是 2011 年 8 月 29 日,我需要一份按月份分组的年度报告,直到 7 月份(因为 8 月份不完整)
select to_char(date,'MONTH YYYY'), sum(number_of_transactions)
from header
group by date
order by date
I am using the below query to list the number of transactions by month. Does anyone know how can I list by year too. This means that the query returns all my transactions for the whole year except the current month.
That is if today it is the 29th August 2011 I need a yearly report grouped by month till the month of July (since august is not complete)
select to_char(date,'MONTH YYYY'), sum(number_of_transactions)
from header
group by date
order by date
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这是你需要的吗?
Is this what you need?