Table using joins.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • hastha23
    New Member
    • May 2007
    • 13

    Table using joins.

    Dear friends,

    Am a new guy in this forums.This is my first forum and new guy to oracle.
    I have two tables :

    DEPT:

    deptno

    10
    20
    30
    40


    and

    EMP:

    empno deptno

    1 10
    2 10
    3 20
    4 20
    5 30
    6 30
    7 40
    8 40


    i expecting the output below:

    empno deptno
    1 10
    2
    3 20
    4
    5 30
    6
    7 40
    8

    Expecting Your replies..better and best.
    Any body help me..

    Regards,
    Hastha23.
  • frozenmist
    Recognized Expert New Member
    • May 2007
    • 179

    #2
    Hi Hastha,
    Welcome to TSDN!!!
    The experts here will be more than happy to respond to your post.
    But why dont you also post what you have tried, so that they can correct you where you did the mistake, rather than doing it for you.
    Please do post your code.

    Cheers

    Comment

    • hastha23
      New Member
      • May 2007
      • 13

      #3
      Dear frozen

      I dont know that query,so i ask about you..

      Hastha23

      Comment

      • frozenmist
        Recognized Expert New Member
        • May 2007
        • 179

        #4
        Hi Hastha,
        Try using a left outer join.
        Dept table on employee table.
        Try out the query and please do post it if any doubts in the query.

        Cheers

        Comment

        • febyfelix
          New Member
          • May 2007
          • 9

          #5
          This Will Give The Output......

          Select C.empno,t.deptn o From Feb_emp C ,
          (

          Select Min(a.empno) Empno,a.deptno From Feb_emp A
          Group By A.deptno

          )t

          Where C.empno=t.empno (+)
          Order By C.empno

          Comment

          Working...