How do I calculate a profit for each month in MS A

2019-09-05 07:03发布

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条回答
可以哭但决不认输i
2楼-- · 2019-09-05 07:43

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
查看更多
登录 后发表回答