Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Count help

Author  Topic 

anikethu
Starting Member

1 Post

Posted - 2013-04-21 : 00:11:06
I have a table with teacher id, & titles. Another table with all the kids and the classes they are enrolled in with the teachers. I need to the count of how many kids does each teacher teach, and include the teachers who don't teach any kids. How do I do it?

Names of table are teacher, and students.

jackv
Master Smack Fu Yak Hacker

2179 Posts

Posted - 2013-04-21 : 02:17:22
You would create a sql statement , using a JOIN and GROUP BY. Could you post the DDL of the tables including the columns- with some sample rows.

Jack Vamvas
--------------------
http://www.sqlserver-dba.com
Go to Top of Page
   

- Advertisement -