oracle - SQL subselect group function not allowed -


i'm facing problem sql subquery: need write query returns courses number of subscriptions (count(employeenumber)) greater maximum allowed number of subscriptions (maximum).

in original query i'm getting following error: group function not allowed here.

the query:

select c.coursename  courses c  inner join subscriptions s on s.coursecode = c.coursecode  inner join plannedcourses p on p.coursecode = s.coursecode count(s.employeenumber) > (select maximum                                   plannedcourses                                   s.coursecode = p.coursecode); 

the table layout:

table layout

how can achieve desire result?

thanks in advance!!

you rewrite query follows:

select c.coursename   courses c   join subscriptions s     on (s.coursecode = c.coursecode)   join plannedcourses p     on (p.coursecode = c.coursecode)   group c.coursename           , p.maximum   having count(s.employeenumber) > p.maximum  

Comments

Popular posts from this blog

curl - PHP fsockopen help required -

HTTP/1.0 407 Proxy Authentication Required PHP -

java - More than one row with the given identifier was found: 1, for class: com.model.Diagnosis -