Group by Having Count(*)
Hi...
I'm back again and I'm ever hopeful that I will get some needed help.
I'm trying to use the groupby and having Count(*) on a table, but I think
I have my group by wrong...I keep getting the wrong output.
Here's my code:
Select Course_ID,Count(*),Department_ID,Class_ID,Class_Room
from Class
Group By Course_ID,Department_ID,Class_ID,Class_Room
Having Count(*) >=1
;
and this is the output:
COURS COUNT(*) DEPARTMENT_ID CLASS_ID CLASS_ROOM
----- ---------- -------------------- -------------------- -----------
50 1 MATH 103600 140
101 1 BIO 109100 180
101 1 ENGL 108300 150
115 1 HIST 108400 200
183 1 PSYCH 103400 150
183 1 PSYCH 108600 240
184 1 HIST 104500 200
198 1 PHILO 104200 150
199 1 ENG 110300 255
199 1 ECON 120200 235
Now, what should be happeing is that Count should give me 2*101,2*183,2*199 but I keep
getting 1 of each...
Any ideas about where I'm going Wrong?