Professional Web Applications Themes

How do I compare two tables? - ASP Database

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)....

  1. #1

    Default How do I compare two tables?

    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 Guest

  2. #2

    Default Re: How do I compare two tables?

    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" ?
    What database?

    --
    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] Guest

  3. #3

    Default Re: How do I compare two tables?

    You could use a LEFT JOIN, but you'll need to provide more information.
    What database are you using, what version? What are the keys in the tables?

    --
    [url]http://www.aspfaq.com/[/url]
    (Reverse address to reply.)





    "Lord Merlin" <SPAM_lordmerlinbonzai.org.za_SPAM> wrote in message
    news:ccs9ol$ral$1ctb-nnrp2.saix.net...
    > 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" ?

    Aaron [SQL Server MVP] Guest

  4. #4

    Default Re: How do I compare two tables?

    Take the table with the most records and do something like this:
    select t1.name, t1.company_name
    from company t1 left outer join
    company_scores t2 on t1.name = t2.company_scores

    w/o more info. this is the best I can do for you.

    "Lord Merlin" <SPAM_lordmerlinbonzai.org.za_SPAM> wrote in message news:<ccs9ol$ral$1ctb-nnrp2.saix.net>...
    > 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).
    CST Guest

Similar Threads

  1. Compare 2 PDF
    By Claus_Allgeier@adobeforums.com in forum Adobe Acrobat SDK
    Replies: 2
    Last Post: December 10th, 02:08 PM
  2. compare
    By Piet in forum MySQL
    Replies: 3
    Last Post: April 9th, 01:57 AM
  3. compare two tables?
    By Lord Merlin in forum ASP Components
    Replies: 1
    Last Post: July 12th, 12:21 AM
  4. how do you compare two strings
    By Peter in forum ASP
    Replies: 2
    Last Post: September 25th, 06:17 AM
  5. Compare 2 tables efficiently.
    By Erik Hendrix in forum IBM DB2
    Replies: 1
    Last Post: September 6th, 12:50 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139