Please solve this query

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • gsreenathreddy
    New Member
    • Oct 2007
    • 40

    Please solve this query

    Hi!


    Please solve this query

    in employee table in scott user i would like view the details of all the employees (empno, ename )who are working under which manager(mgr) .with his manager name and manager employee id.
  • krishhhna
    New Member
    • Aug 2007
    • 13

    #2
    Originally posted by gsreenathreddy
    Hi!


    Please solve this query

    in employee table in scott user i would like view the details of all the employees (empno, ename )who are working under which manager(mgr) .with his manager name and manager employee id.

    Hi,
    This is krishna,you can try this one .i think it would be correct

    [code=oracle]Select E.empno,E.ename ,M.empno,M.enam e from emp E,emp M where E.mgr=M.empno;[/code]
    Last edited by debasisdas; Dec 20 '07, 07:22 AM. Reason: formatted using code tags

    Comment

    • debasisdas
      Recognized Expert Expert
      • Dec 2006
      • 8119

      #3
      The example in the previous post is self join. the table is joined to itself using two alias for the same table.

      Comment

      Working...