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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Compare 2 Tables reaturn all records

Status
Not open for further replies.

RJL1

Technical User
Oct 3, 2002
228
US
Hi,

I'm working on comparing 2 tables identical structure

Table A has 157 unique items
Table B has 102 unique items

Some of the items are in both tables. However there are items in A that do not exist in B and items in B that do not exist in A.

How can I get a list of all the items from both table A nd B that also shows the ones that match

Sample Output

Code:
ITEM (A)    DESCRIPTION (A)   ITEM (B)   DESCRIPTION (B)   

90887       BLUE WIDGETS      NULL       NULL
89443       RED WIDGETS8      89443      RED WIDGETS
NULL        NULL              56477      GREEN WIDGETS

Thanks in advance
RJL

 
Just do an outer join..

Select a.item, a.DESCRIPTION, b.ITEM, b.DESCRIPTION
from atable a
full outer join btable b
on a.item=b.item

Simi
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top