Help need in SELECT statement

  • I have two tables called TableA and TableB

    TableA

    Col1 ID

    Col2 CDate

    Cpl2 name

    TableB

    Col1 ID

    Col2 CDate

    Cpl2 name

    for particular time period i need to select rows from tableA not exist in TableB

    Like

    SELECT * FROM TableA WHERE (CDate BETWEEN date1 and date2) AND ID NOT IN

    (SELECT ID FROM TableB WHERE (CDate BETWEEN date1 and date2))

    Is there any best way to do this, please help me if you have any solutions.

    Thanks

    srgangu

  • select A.*

    from TableA A LEFT JOIN TableB B

    ON A.ID = B.ID

    Where B.ID IS NULL And (A.CDate BETWEEN date1 and date2)


    * Noel

  • Thanks, It worked.

     

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

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