oracle10g - counting in sql in subquery in the table -


 dno dname   ----- -----------  1 research  2 finance   en   ename      city           salary        dno join_date   --  ---------- ---------- ---------- ---------- ---------  e1   ashim      kolkata         10000          1 01-jun-02  e2   kamal      mumbai          18000          2 02-jan-02  e3   tamal      chennai          7000          1 07-feb-04  e4   asha       kolkata          8000          2 01-mar-07  e5   timir      delhi            7000          1 11-jun-05 

//find departments have more 3 employees.

my try

select deptt.dname  deptt,empl  deptt.dno=empl.dno , (select count(empl.dno) empl group empl.dno)>3;  

here solution

select deptt.dname   deptt,empl  deptt.dno=empl.dno  group deptt.dname having count(1)>3;  

Comments

Popular posts from this blog

php - Submit Form Data without Reloading page -

linux - Rails running on virtual machine in Windows -

php - $params->set Array between square bracket -