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!

Problem with Joining Tables

Status
Not open for further replies.

Doris

MIS
Sep 25, 2000
9
US
I am trying to find unique table values between two databases. These are SQL tables.

I have two databases that track similar data (Database #1 and Database #2) that have tables with the same name (Table)and they are supposed to have the same number of records with the same information. However, we have found that entries have been put into one table and not replicated to the other database. I am trying to get a list of entries that are in one table and not the other.

I was thinking the link between the two tables should be an outer join, but it doesn't seem to be pulling correctly.

Any ideas?

Thanks!
[sig][/sig]
 
1) Join the tables on the unique identifier field that they have in common.
2) Join from the longer table to the shorter table, and then set the join to be left outer.
3) Use a selection formula that says

IsNull({table2.field})

where this field is the link field in the shorter table.


If you don't have a unique identifier that links these two tables together it gets a bit tricker. You will have to identify the set of fields required to identify a unique record, and create a multi-arrow left outer join.

Use a similar selection formula [sig]<p>Ken Hamady<br><a href=mailto:ken@kenhamady.com>ken@kenhamady.com</a><br><a href= Reports Training by Ken Hamady</a><br>[/sig]
 
You will need a set operator to do this. In standard SQL, the operator is called EXCEPT, in Oracle MINUS, and in SQL Server it is done through a WHERE NOT EXISTS. What flavor of SQL database are you using? [sig][/sig]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top