If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > Pervasive.SQL > Comparing records in 2 tables

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 04-06-04, 02:23
focus77 focus77 is offline
Registered User
 
Join Date: Apr 2004
Posts: 4
Comparing records in 2 tables

Halo...

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.
Reply With Quote
  #2 (permalink)  
Old 04-06-04, 08:29
mirtheil mirtheil is offline
Registered User
 
Join Date: Dec 2001
Posts: 1,026
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
http://www.mirtheil.com
I do not answer questions by email. Please post on the forum.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On