Results 1 to 2 of 2
  1. #1
    Join Date
    Apr 2004

    Unanswered: Comparing records in 2 tables


    I have 2 , tables A and Table B. Both contains the same number of records. Table A has 10 fields while Table B will have 12 fields.

    Is there any Pervasive SQL scripts where I can write to compare if all the records in both Table A and B are the same?

    Appreciate all advises.

  2. #2
    Join Date
    Dec 2001
    Provided Answers: 6
    Because there are different numbers of fields in the two tables, none of the records will be exactly the same. If the 10 fields in Table A are also in Table B, then you can compare that part of the record.
    Because you mention script, I'm guessing you want an SQL statement. It would go something like:
    select * from TableA A, TableB B where A.f1 = B.f1 and A1.f2 = B.f2 and A.f3 = B.f3 ... and so on until you've got all of the fields you want to compare.
    Note, unless you have an index on these ten fields on both tables, it will scan every record in the table and will be slower depending on the number of records.
    Mirtheil Software
    Certified Pervasive Developer
    Certified Pervasive Technician
    Custom Btrieve/VB development
    I do not answer questions by email. Please post on the forum.

Posting Permissions

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