SQL Server Performance

Using Not Exist in SQL

Discussion in 'SQL Server 2005 General Developer Questions' started by skd, Dec 5, 2007.

  1. skd New Member

    Hi,Wanted to know if I can use some join or a better way
  2. Adriaan New Member

    The NOT EXISTS subqueries are correct.
    You might get better performance with LEFT JOINs and NULL criteria, but it all depends on the actual data - so you need to compare both versions:
    SELECT DISTINCT parid FROM pardat
    LEFT JOIN dweldat ON dweldat.parid = pardat.parid
    LEFT JOIN comdat ON comdat.parid = pardat.parid
    WHERE dweldat.parid IS NULL AND comdat.parid IS NULL
    By the way - why the quotes around the identifier names? That is rather old-fashioned.
  3. FrankKalis Moderator

    Looks like the original post has been edited and some important fragments been removed.
  4. Madhivanan Moderator

Share This Page