How to extract the difference data records from two similar tables 
Author Message
 How to extract the difference data records from two similar tables

  I am working on two tables which have the same structure but
  some different data records.  How can I extract those different
  records?  This seems to be a common problem which happens to
  any one is working on data manipulation.  
  It is appreciated if you can answer this in SQL statements.
  That's all.  Thanks.



Sat, 30 Jan 1999 03:00:00 GMT  
 How to extract the difference data records from two similar tables


Quote:

>  I am working on two tables which have the same structure but
>  some different data records.  How can I extract those different
>  records?  This seems to be a common problem which happens to
>  any one is working on data manipulation.  
>  It is appreciated if you can answer this in SQL statements.
>  That's all.  Thanks.

You can use two select statements, with a union if you prefer.  Generally:

select * from table1 where not exists
                (select * from table2 where recid=table1.recid)
[same thing again swapping table1 and table2]

Another possibility is:

select * from table1 where recid not in (select recid from table2)
[same thing again swapping table1 and table2]

Rushmore will be happy to optimize both queries given the necessary indexes.

        Darrin

--
Michael Darrin Chaney     Consulting & Custom Programming for Today's Business

Phone: (812)333-6311 & (800)711-4240  Fax: (812)333-1894



Sat, 30 Jan 1999 03:00:00 GMT  
 How to extract the difference data records from two similar tables

Quote:

>   I am working on two tables which have the same structure but
>   some different data records.  How can I extract those different
>   records?  This seems to be a common problem which happens to
>   any one is working on data manipulation.
>   It is appreciated if you can answer this in SQL statements.
>   That's all.  Thanks.

I'll get you started, but you'll have to take it from here.

select ;
  * ;
  from file1 where key not in ;
  (select ;
    key ;
    from file2)

Bill



Sat, 30 Jan 1999 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Difference between two tables

2. displaying records in two related tables

3. Selecting two records from the same child table?

4. displaying records in two related tables

5. Pulling data from two tables to a report

6. data from two table

7. One Form to enter data in Two Tables

8. Can I add two table data into a grid

9. HELP-Two input screens with fields from two related tables

10. Way to figure out number of months difference between two dates

11. How to determine the difference between two dates?

12. Records with similar names are missing

 

 
Powered by phpBB® Forum Software