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

php - get table cell data from and place a copy in another table -

javascript - Mootools wait with Fx.Morph start -

php - Navigate throught databse rows -