Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Calculate multiple total from different tabels in one query

Status
Not open for further replies.

klaas01

MIS
Feb 5, 2005
16
NL
Hi,

I am building a scoreboard to show te results of the sales group in my company.

There are 3 tables:
- sales employees
- Offertes
- sales

What i want is a query which calculates the total number of offertes and sales for each sales employee in a period (year/month / week)

Is there a way doing this in one query are is this only possible with sub queries?

grtz klaas







 
Most likely, yes. However, you will need to show some table structure if not we can only guess. Ex:

tblName
fldName1 (primary Key)
fldName2
fldName3 (foriegn Key To tblName2)

etc
 
G'day fella,

try something like:

Code:
SELECT [sales employees].empID, [sales employees].empName, Sum(offert.offeramount) AS SumOfofferamount, Sum(sales.amount) AS SumOfamount

FROM ([sales employees] 

INNER JOIN offert ON [sales employees].empID = offert.empid) 

INNER JOIN sales ON [sales employees].empid = sales.empid

GROUP BY [sales employees].empName;

JB
 
If your tables are set up correctly, as mentioned we can only guess, then look at Pivot Table.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top