How do I compare two tables?

Ask a Question related to ASP Database, Design and Development.

  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. Similar Questions and Discussions

    1. Compare 2 PDF
      Hi, is there any way to automate the comparison of two PDFs from outside Acrobat? e.g. I mark 2 PDFs, right-click offers me COMPARE and after...
    2. compare
      How can I stop a function in PHP? When comparing data I want to stop the function on a hit. Function compare($data) { For...
    3. compare two tables?
      How do I compare the contents of two tables, to see what doesn't exist in the one table? Someting like "select company.name,...
    4. Compare strings
      Hi, I'm trying to see if a certain string matches a predefined string so I've tried: -------------- If txtCondition3 = "NO THEFT COVER unless...
    5. Compare 2 tables efficiently.
      Hi, I have received the challenge to compare a table and a view. What I need to do is to check on certain columns if all entries in view A are in...
  3. #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

  4. #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_lordmerlin@bonzai.org.za_SPAM> wrote in message
    news:ccs9ol$ral$1@ctb-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

  5. #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_lordmerlin@bonzai.org.za_SPAM> wrote in message news:<ccs9ol$ral$1@ctb-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

Posting Permissions

  • You may not post new threads
  • You may 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