Joins

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • rashmiks
    New Member
    • Nov 2006
    • 9

    Joins

    Hi ,

    i want get missing id from table which are there in other table

    EX
    Employee table
    EMP_ID EMP_NAME
    ------------------------------------
    1 DDD
    2 AAA
    3 EEE
    ------------------------------

    Empdep table

    EMP_ID EMP_DEP
    -----------------------------------
    3 accounts
    -------------------------------------

    since EMP_ID 1 and 2 are missing in table 2 , i should write a qry get these 2 values by joining Employee table and empdep table .

    plz help me solving the problem ..
  • sarma
    New Member
    • Sep 2006
    • 18

    #2
    Hi,

    U can write a simple join query as

    select id from emp e, dept d
    where e.id !=d.id;

    This will give emp ids which are not included in any depts.(change the table names according to your names)


    regards
    sarma

    Comment

    Working...