Results 1 to 4 of 4

Thread: Emp

  1. #1
    Join Date
    Feb 2004
    Location
    inida
    Posts
    62

    Smile Unanswered: Emp

    Hi,

    Based on EMP table, I want the query for the following requirement

    Display the list of employees whose deptno is different from thier manager's dept.DEPTNO
    So the output shold display only the names

    JONES
    BLAKE

    Thanx.

  2. #2
    Join Date
    Nov 2004
    Posts
    19
    try it!

    select ename
    from emp a
    where deptno not in (select deptno
    from emp b
    where empno = a.mgr)

  3. #3
    Join Date
    Sep 2002
    Location
    UK
    Posts
    5,171
    Provided Answers: 1
    Alternatively:
    Code:
    SQL> select e.ename
      2  from emp e, emp m
      3  where e.mgr = m.empno
      4  and e.deptno != m.deptno;
    
    ENAME
    ----------
    JONES
    BLAKE

  4. #4
    Join Date
    Feb 2004
    Location
    inida
    Posts
    62
    Thanx a Lot..

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •