?? on finding records that don't match

  • Hi,

    I'll probably explain this wrong...

    I have a 'provider' table, a provider_to_Provider_identifier, and a provider_Identifier table

    On the front end if a user puts in a identifier, it loads the data to the link table (provider_to_Provider_identifier) and provider_identifier

    it does not if one isn't entered . I want to report on providers that do not have a link to that table, tehrefore dont have a identifier

    Thanks in Advance

    Joe

  • Sounds like you want a NOT EXISTS or NOT IN.

    SELECT <stuff> FROM Table WHERE NOT EXISTS (SELECT 1 FROM AnotherTable WHERE Table.JoinColumn = AnotherTable.JoinColumn)

    SELECT <stuff> FROM Table WHERE Table.JoinColumn NOT IN (SELECT AnotherTable.JoinColumn FROM AnotherTable)

    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
  • Than you.. works great!!

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

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