How do I calculate a profit for each month in MS Access?

对着背影说爱祢 提交于 2019-12-11 18:16:00

问题


I'm quite new to access and I am currently in the process of making a database for my company.

I have a 'Jobs' table with these fields in:

  • Job No.
  • Year Initiated
  • Month Initiated
  • Company ID
  • Job Description
  • Amount Quoted
  • Amount to Invoice
  • Invoice Number
  • Completed By
  • Cost
  • Profit

What I want to know Is what is the best way/ how do I calculate either in a form or query the overall profit for each month?

Please help, the database is really coming along, apart from this is well entruely stuck on.


回答1:


You want to find all rows matching a specific year / month, and add together all the profit entries for that month to get a total?

If so, try this :

select sum(profit) from Jobs where year = 2013 and month = 02

Or, if you want to retrieve this information for all months in one go, try this :

select year, month, sum(profit) from Jobs group by year, month


来源:https://stackoverflow.com/questions/17789984/how-do-i-calculate-a-profit-for-each-month-in-ms-access

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!