SQL Help.

Results 1 to 3 of 3

Thread: SQL Help.

  1. #1
    Matiur Rahman Guest

    Default SQL Help.

    I have two sturcturaly identical tables. Assume both tables have the same number of records.<BR>I would like to check whether the values in both table are the same.<BR><BR>What should be the simple SQL for that?<BR><BR>Thanks in advance.

  2. #2
    Join Date
    Dec 1969

    Default RE: SQL Help.

    Do you need to check all fields or only a primary key? If the latter, it&#039;s just<BR><BR>SELECT * FROM TABLE1 WHERE KEYFIELD NOT IN (SELECT KEYFIELD FROM TABLE2).

  3. #3
    Matiur Rahman Guest

    Default RE: SQL Help.

    Thanks for your reply.<BR>I am thinking like the following. If anyone has better solution, please post here.<BR><BR>Assume two Tables<BR>test1(id1,name1);<BR>test2(id2,name2);<B R><BR>SELECT COUNT(*) count1 FROM test1;<BR><BR>SELECT COUNT(*) count2 FROM(<BR> SELECT * FROM test1<BR> WHERE ((test1.id1=test2id2) AND (test1.name1=test2.name2)))<BR><BR>If count1 and count2 are the same then the two tables have the same value.<BR><BR>

Posting Permissions

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