Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Group by Having Count(*)

352240Oct 16 2002
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?
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Nov 13 2002
Added on Oct 16 2002
3 comments
422 views