This is untested....

SELECT b.branch_id, COUNT(e.emp_id) AS emp_count
FROM Branches b INNER JOIN Employees e
ON b.branch_id = e.branch_id
ORDER BY b.branch_id


-----Original Message-----
From: Les Mizzell [mailto:[EMAIL PROTECTED]] 
Sent: Tuesday, December 17, 2002 2:36 PM
To: CF-Talk
Subject: Counting Matching Records


I've got two tables

A. Branches
B. Employees

I need to loop through the "Branches" table, and count the number of
matching employees from the employees table..

Branch A
   13 employees
Branch B
   14 employees


RecordCount won't work here, will it?  What's the best way to do this?


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
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
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

Reply via email to