Select total cost based on division

gogaak

Registered User.
Local time
Today, 18:00
Joined
Feb 6, 2005
Messages
42
hello all,

I have got 3 tables for employee training programs
Employee
TokenID (pk)
Name
Division

Training_Program
Prog_ID (pk)
Cost

Employee_program
Serial_no
TokenID (fk)
Prog_ID (fk)

Training programs are conducted for all divisions.Employee from two divisions can also attend the same program..

If any employee who belongs to some division attends a training program,then I would like to display the cost of training program per division.

somthing like..
select sum (cost) from table group by Division


please do help
thanks a lot
 
SELECT [Employee].[Division], Sum([Training_Program].[Cost]) AS TotalCost
FROM (Employee INNER JOIN Employee_program ON [Employee].[TokenID]=[Employee_program].[TokenID]) INNER JOIN Training_Program ON [Employee_program].[Prog_ID]=[Training_Program].[Prog_ID]
GROUP BY [Employee].[Division];
.
 

Users who are viewing this thread

Back
Top Bottom