Avoid a Cartesian plane in a join with 2 tables with duplicates

0

According to the image above:

The A1 field of TableA has two duplicate values which is key 3 and TableB with the B1 field has the same duplicate values.

I wanted to make a inner join between the two tables using the fields A1 of TableA and B1 of TableB as keys and bring as results the values of the fields A2 and B2 without generating a Cartesian.

Desired result:

A2 B2 
a   a
b   a    
c   c 
d   f 

I tried to do it:

Select  A2, b.B2 
    from Table_A as a 
    inner join Table_B  as b
    on a.a1 = b.b1  

Result acquired with query above:

A2, B2
a   a
b   a
c   c
d   c
c   f
d   f
    
asked by anonymous 07.07.2017 / 23:55

0 answers