Comparing two tables and spitting out an XLS

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Your name

    Comparing two tables and spitting out an XLS

    Hi,

    I'm trying to figure out a way to compare two tables, table one has more
    entries than table two, I want SQL to compare table one to table two and
    spit out and XLS of the enries that exist in table one, but not in table
    two.

    So far I can't even get my query right...heh

    select * from table1 a
    left join tabl2 b on a.column=b.colu mn
    where a.column exists not b.column


    am I missing an "in" in the select portion on my query?

    thanks alot for any help.
  • Erland Sommarskog

    #2
    Re: Comparing two tables and spitting out an XLS

    Your name (fake.email@add ress.com) writes:
    I'm trying to figure out a way to compare two tables, table one has more
    entries than table two, I want SQL to compare table one to table two and
    spit out and XLS of the enries that exist in table one, but not in table
    two.

    SELECT a.*
    FROM a
    WHERE NOT EXISTS (SELECT *
    FROM b
    WHERE a.keycol = b.keycol)


    --
    Erland Sommarskog, SQL Server MVP, esquel@sommarsk og.se

    Books Online for SQL Server 2005 at

    Books Online for SQL Server 2000 at

    Comment

    Working...