join with no mtach

  • I am a newbee to SQL and i require following qurery:

    I have two tables like below:

    Table ATable B

    Col1Col2Col3Col1Col2Col3

    A1A2A2C1C2C3

    B1B2B3P1P2P3

    C1C2C3W1W2W3

    D1D2D3X1X2X3

    E1E2E3Y1Y2Y3

    P1P2P3

    Q1Q2Q3

    Now What i require is, i like to get map col1 and col2 from TableA to TableB and extract all records from A which are not matching .

    Result set from table A should be

    A1A2A2

    B1B2B3

    D1D2D3

    E1E2E3

    Q1Q2Q3

    TIA

    raj

    -----------------------------------------------------------------------
    For better assistance in answering your questions[/url]
    Perforamance Issues[/url]
    Cross Tabs and Pivots[/url]
    Cross Apply[/url]
    The Numbers or Tally Table- Jeff Moden[/url]

  • This is a simple OUTER JOIN query - look it up in Books Online for further information.

    SELECT ...

    FROM dbo.TableA a

    LEFT OUTER JOIN dbo.TableB b ON b.col1 = a.col1

    WHERE b.col1 IS NULL;

    Jeffrey Williams
    “We are all faced with a series of great opportunities brilliantly disguised as impossible situations.”

    ― Charles R. Swindoll

    How to post questions to get better answers faster
    Managing Transaction Logs

  • thanks a lot...

    -----------------------------------------------------------------------
    For better assistance in answering your questions[/url]
    Perforamance Issues[/url]
    Cross Tabs and Pivots[/url]
    Cross Apply[/url]
    The Numbers or Tally Table- Jeff Moden[/url]

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

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