comparing two tables?

Discussion in 'ASP General' started by Lord Merlin, Jul 11, 2004.

  1. Lord Merlin

    Lord Merlin Guest

    How do I compare the contents of two tables, to see what doesn't exist in
    the one table?

    Something like "select company.name, company_scores.company_name from
    company, company_scores where company.name not in
    company_scores.company_name" ?

    --


    Kind Regards
    Rudi Ahlers
    +27 (82) 926 1689

    Greater love has no one than this, that he lay down his life for his friends
    (John 15:13).
     
    Lord Merlin, Jul 11, 2004
    #1
    1. Advertising

  2. Lord Merlin wrote:
    > How do I compare the contents of two tables, to see what doesn't
    > exist in the one table?
    >
    > Something like "select company.name, company_scores.company_name from
    > company, company_scores where company.name not in
    > company_scores.company_name" ?


    Please don't multipost. I've already replied to this question over at
    ..asp.db. If you feel you must direct your question at multiple
    newsgroups*, then post one single message to the desired groups by
    putting the group names into the To list (aka crosspost)

    *.asp.db is the only group you needed to post this to. Your question
    concerns asp and database code: absolutely no ambiguity.

    Bob

    --
    Microsoft MVP - ASP/ASP.NET
    Please reply to the newsgroup. This email account is my spam trap so I
    don't check it very often. If you must reply off-line, then remove the
    "NO SPAM"
     
    Bob Barrows [MVP], Jul 11, 2004
    #2
    1. Advertising

  3. Lord Merlin

    Binoj Antony Guest

    Try This

    <CODE>

    SELECT company.name, company_scores.company_name
    FROM company
    LEFT JOIN company_scores ON (company_scores.company_name = company.name)
    WHERE company_scores.company_name IS NULL

    OR

    SELECT company.name, company_scores.company_name
    FROM company
    LEFT JOIN company_scores ON (company_scores.company_name = company.name)
    WHERE company.name IS NULL

    </CODE>
     
    Binoj Antony, Jul 12, 2004
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Peter Bassett
    Replies:
    3
    Views:
    958
    Augustus
    Aug 15, 2003
  2. GenxLogic
    Replies:
    3
    Views:
    1,350
    andrewmcdonagh
    Dec 6, 2006
  3. JJ297

    Comparing two tables

    JJ297, Sep 28, 2007, in forum: ASP .Net
    Replies:
    3
    Views:
    336
    JJ297
    Sep 28, 2007
  4. Paolo

    Two dropdownlist and two tables...

    Paolo, Sep 19, 2006, in forum: ASP .Net Web Controls
    Replies:
    0
    Views:
    151
    Paolo
    Sep 19, 2006
  5. Rem-8

    Comparing hash tables

    Rem-8, Dec 4, 2006, in forum: Perl Misc
    Replies:
    5
    Views:
    193
    Rem-8
    Dec 6, 2006
Loading...

Share This Page