Les Mizzell wrote:
> 
> Tables as follows:
> 
> Table of Branches
> -----------------
> Branch_Name
> Branch_ID
> 
> Table of Employees
> -----------------
> Employee Name
> Employee_ID
> Branch_ID - (to tie the employees to their branch)
> 
> Table of Contracts
> ------------------
> Contract_Name
> Employee_ID - (to tie a specific employee from a branch to a contract)
> 
> 
> What I need to find out is for each branch, how many contracts total are
> assigned to employees of that branch...

SELECT     Count(c.Contract_Name), b.Branch_Name
FROM       Branches b NATURAL JOIN Employees e NATURAL JOIN Contracts c
GROUP BY   b.Branch_Name
ORDER BY   b.Branch_Name

Jochem

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: 
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Your ad could be here. Monies from ads go to support these lists and provide more 
resources for the community. http://www.fusionauthority.com/ads.cfm

Reply via email to