Home Forums SQL Server 7,2000 T-SQL Convert my syntax - Oracle SQL to MS SQL Server RE: Convert my syntax - Oracle SQL to MS SQL Server

  • It looks a little wierd, but this is what you want. A not in for 2 fields.

    Select table1.* from table1 LEFT OUTER join table2 on table1.f1=table2.f1 and table1.f2=table2.f2

    WHERE Table2.f1 is null and table2.f2 is null

    This is an alternative that will also work

    Select * from table1 WHERE NOT EXISTS (Select 1 FROM table2 where table1.f1=table2.f1 and table1.f2=table2.f2)

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass