Quantcast
Channel: Microsoft SQL Server
Viewing all articles
Browse latest Browse all 4871

SQL Join creates duplicates

$
0
0

Hi,

A very simple query I am sure, but one that has me stumped. Apologies for the poor explanation as I am new to SQL...

I have 2 table of data as follows: -

Table1
Date_of_Incident
Handler
Amount_paid
Amount_outstanding
Branch_Number
Claim_Open

Table2
Branch_Number
Branch_Name
Branch_Address_1
Branch_Address_2
Branch_Address_3

Basically I want to return all of the information from Table 1 where CLAIM_OPEN = 'Y' and I can do this fine.

In addition I am trying toreturn the full name of the branch and not just the branch number so I am trying toJoin Table2 on Table2.Branch_Number=Table1.Branch_Number and then also selecting Table2.Branch_Name within my Output

Without my join I get the expected number of results, but as soon as I introduce the join I seem to create duplicate entries (what appears to be one for each of the branches listed in Table2).

Am I...


Viewing all articles
Browse latest Browse all 4871

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>