Join Filter to find mismathced replica records

Discussion in 'microsoft.public.sqlserver.programming' started by Patrick, Jun 7, 2006.

  1. Patrick

    Patrick Guest

    I have 2 tables, tblMaster,tblReplica of the following structure:
    category
    product

    tblReplica is meant to be a close replica of tblMaster but I want to find
    rows in tblReplica that
    - with a category where the product is different from what could be found in
    tblMaster.

    Note that a product can belong to multiple categories.

    How could I use a "Join Filter" to find such mismatch?
     
    Patrick, Jun 7, 2006
    #1
    1. Advertisements

  2. Patrick

    Tom Moreau Guest

    Please post your DDL + INSERT statements of your data + expected results.

    --
    Tom

    ----------------------------------------------------
    Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
    SQL Server MVP
    Toronto, ON Canada
    ..
    I have 2 tables, tblMaster,tblReplica of the following structure:
    category
    product

    tblReplica is meant to be a close replica of tblMaster but I want to find
    rows in tblReplica that
    - with a category where the product is different from what could be found in
    tblMaster.

    Note that a product can belong to multiple categories.

    How could I use a "Join Filter" to find such mismatch?
     
    Tom Moreau, Jun 7, 2006
    #2
    1. Advertisements

  3. Patrick

    Omnibuzz Guest

    from what I understood...

    select a.* from tblreplica a left outer join tblmaster b
    on a.category = b.category
    and a.product = b.product
    where b.category is null

    Let me know if this helps.
     
    Omnibuzz, Jun 7, 2006
    #3
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.