Home » SQL & PL/SQL » SQL & PL/SQL » ORA-00937 - Count() problem
ORA-00937 - Count() problem [message #275828] Mon, 22 October 2007 20:35 Go to next message
someone_somebody
Messages: 5
Registered: September 2007
Junior Member
Hi,

I keep getting this error ORA-00937(not a single-group group funtion). I have tried adding a Group By but it still post me an error. I hope you could help me point out where I have gone wrong.

Thank you.



select b.course_code, a.tutgrp, a1.name, b.adm_no, b.pgm_code, b.basket_code,
b.module_code, c.module_abbr, b.module_grp, b.repeat_cnt, b.module_status, count(b.module_code)
from student_courses a, student_particulars a1, student_study_pgms b, modules c,
module_offered d
where c.module_code = d.module_code
and c.module_version = d.module_version
and d.module_code = b.module_code
and d.acad_yr = b.acad_yr
and d.semester = b.semester
and a.studstatus = 'E'
and b.adm_no = a.adm_no
and a.course_code = b.course_code
and a1.adm_no = b.adm_no
and &P_where
having count(b.module_code) >= 8
union
select b.course_code, a.tutgrp, a1.name, b.adm_no, b.pgm_code, b.basket_code,
b.module_code, c.module_abbr, null, b.repeat_cnt, 'C', count(b.module_code)
from student_courses a, student_particulars a1, student_completed_modules b, modules c,
module_offered d
where c.module_code = d.module_code
and c.module_version = d.module_version
and d.module_code = b.module_code
and d.acad_yr = b.acad_yr
and d.semester = b.semester
and not exists (select '1' from student_study_pgms e
where e.adm_no = b.adm_no
and e.course_code = b.course_code
and e.acad_yr = b.acad_yr
and e.semester = b.semester
and e.module_code = b.module_code)
and a.studstatus = 'E'
and b.adm_no = a.adm_no
and b.credit_trf = 'Y'
and a.course_code = b.course_code
and a1.adm_no = b.adm_no
and &P_where
having count(b.module_code) >= 8
order by 1, 2, 3,7
Re: ORA-00937 - Count() problem [message #275832 is a reply to message #275828] Mon, 22 October 2007 20:52 Go to previous messageGo to next message
BlackSwan
Messages: 25033
Registered: January 2009
Location: SoCal
Senior Member
Read & follow posting guidelines as stated here: http://www.orafaq.com/forum/t/88153/0/

I'm old & going blind, but I did not see any GROUP BY clause in the SQL posted.

GROUP BY b.course_code, a.tutgrp, a1.name, b.adm_no, b.pgm_code, b.basket_code,
b.module_code, c.module_abbr, b.module_grp, b.repeat_cnt, b.module_status
Re: ORA-00937 - Count() problem [message #275834 is a reply to message #275832] Mon, 22 October 2007 21:19 Go to previous messageGo to next message
someone_somebody
Messages: 5
Registered: September 2007
Junior Member
Hi,

I apologise for my improper post. Will most certainly try my best to follow the guidelines. Thank you for your guidance.

I found out where my mistake was. I had not included all the columns in my Group by statement.

Thank you for your help. Have a nice day!

[mod-edit] removed FONT clause - it was too small.


[Updated on: Tue, 23 October 2007 07:58] by Moderator

Report message to a moderator

Re: ORA-00937 - Count() problem [message #275862 is a reply to message #275834] Tue, 23 October 2007 01:33 Go to previous message
Maaher
Messages: 7062
Registered: December 2001
Senior Member
Thanks for the feedback!

MHE
Previous Topic: alternative to dbms_lock.sleep()
Next Topic: Trigger in Function
Goto Forum:
  


Current Time: Sat Dec 03 07:46:52 CST 2016

Total time taken to generate the page: 0.22478 seconds