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.
| Author |
Topic |
|
ncp905
Starting Member
4 Posts |
Posted - 2009-03-17 : 21:47:07
|
| Hi I'm doing the following querry:SELECT class.classCode,className, COUNT(csNum)AS 'Num Sections',COUNT(instructor.instrID)AS 'Num Instructors', SUM(classHours) AS 'Total Class Hours' FROM class,instructor,class_sectionWHERE class.classCode = class_section.classCodeAND instructor.instrID = class_section.instrID GROUP BY classCodeHAVING COUNT(DISTINCT instrLast);= (SELECT COUNT(*) FROM instructor);i'm trying to get it to show the number of different teachers teaching a multiple section class and instead it's showing me the total teachers whether one teaches more than one section or not even though I have clause that's counting distinct teachers based on the subselect as our prof. pointed out in a the same example with fewer outputs and different tables, attributes,etc.What would be the correct way to write this out?Thanks |
|
|
darkdusky
Aged Yak Warrior
591 Posts |
Posted - 2009-03-20 : 07:34:12
|
| Can you include create table scripts / sample data |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
|
|
|
|
|