issue with join condition while using in the corelated sub query [message #395750] |
Thu, 02 April 2009 09:19  |
mrboopathiraja
Messages: 1 Registered: April 2009 Location: Bangalore
|
Junior Member |
|
|
Bees,
I am not able to use the below query since i have used a join condition in the corelated sub qery inline view.But i have a requirement like this . Please help me on this
select * from dept d
where exists (select 1 from (
select deptno
from emp where deptno= d.deptno)
)
Exactly the need is like below
SELECT *
FROM dept d
WHERE EXISTS (SELECT case when a.c_dept>1 then 1+s_sal else 2+s_sal end
FROM
(SELECT count(deptno),deptno c_dept FROM emp WHERE deptno = d.deptno group by deptno) a
,(select sum(sal) s_sal,deptno from emp_sal where deptno=d.deptno group by deptno) b
where a.deptno=d.deptno
)
Thank you
|
|
|
|