Inner join Without duplicates, is it possible?

sql

Solution

You can wipe out the duplicates by using `DISTINCT`

select distinct
  A1.col1,
  A2.PK
from
  A1
  inner join A2
          on A1.col1 = A2.col2

Problem

Given these two tables Table A1 has two rows with the same value 'a' ``` A1 a a ``` Table A2 has two rows with primary key value A,B and they are associated with 'a' ``` A2 PK col2 A a B a ``` What I want is a join of A1 and A2 with this result ``` a A a B ``` Obviously inner join doesn't work here. Is there a way to do this in SQL Server 2008?

Original source