Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Comparing 2 tables for differences.

Status
Not open for further replies.

mmeadmmm

Technical User
Dec 19, 2001
3
CA
I've been reading up on Crystal to see how to pull out non matching records from table A to table B but nat having much luck. Both tables are indexed and have an identical ID number in each. Does any one know how to export the non matching records from table A?

Thanks
 
You could set an Outer Join from A to B and select all records where the ID columns from table B is null (indicating a matching record couldn't be found and the A record survived the join only by the grace of ther outer join).

Another approach is to write a SQL query (using Crystal SQL Designer or a VIEW in your database) like this:

------------------------------------
SELECT col_A, col_B, col_C
FROM Table_A
WHERE Table_A.ID NOT IN (Select Table_B.ID FROM Table_B)
------------------------------------

Cheers,
- Ido


ixm7@psu.edu
 
The databases that I'm comparing are foxpro databases and will not allow me to add a Join, as well when I try and do the Select - from - Where I get ' The remianining test does not appear to be part of the formula.

Any other ideas?
 
Where are you trying to create the SQL statement?
Is it in Crystal SQL Designer?
Show your full SQL statement.

Are these two tables in a single database or two
different databases?

Cheers,
- Ido
ixm7@psu.edu
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top