Hello all, hopefully my issue is a simple one.
PCS data-details table has 83315 records in it.
[Emp Data] is used to build hierarchy
View_ distinct NPA/NXX and cluster is used to add a market cluster based on the customers number.
here is my join statement.
FROM dbo.[PCS Data - Details] LEFT OUTER JOIN
dbo.[EMP DATA] ON dbo.[PCS Data - Details].[Join Key] = dbo.[EMP DATA].[Join Key] LEFT OUTER JOIN
dbo.[View_Distinct NPA/NAA and cluster] ON SUBSTRING(dbo.[PCS Data - Details].ctn, 1, 6) = dbo.[View_Distinct NPA/NAA and cluster].[NPA/NXX]
as you can see i take the first 6 characters from the mobile number and match it up to the NPA/NXX from the NPA/nxx field in the market table. but my result is giving me more than double the records than i have so i am getting duplicated records. The view that feeds the NPA/NXX is a distinct view based upon the same idea in a table that already has market clusters and i have verified that there are no suplicates in the view that does this calculattion.
Can anyone provide me with a better join that doesnt return so many duplicates? I would like to show only the PCS data.
I am doing this from MSSQL within SQL Server Management Studio 2005.
You can see in the attached Picture all of the field in the three tables i am trying to use to make this work.