Need help with JOIN

  • Hi all ,

    I kwow this is silly but I am a newbee would lke help with JOINS.

    I have two tables, Table A and Table B

    I need a query that will get the records of TABLE A that re not present in table B

    If I use the NOT the execution time is too long , pelase help.

    Select [IDNo], [Refno] TABLEA where (cty='NY') and ([ID no] not in (select [ID no] from TABLEB)

    group by [IDNo], [Refno]

    The query take a long time to complete (over 2 minutes) Can some one help pelase.

    Thanks

    Sab

  • Try This

    Select idNo, RefNo

    From TableA

    Left Join TableB on TableA.IDNo = TableB.IDno

    where TableA.cty='NY'

      and TableB.IDNo is NULL

  • Ray, Thank you So much, it works

    Sab

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply