I am trying to create a very simple view to associate the EVP from an HR data table (TBLCCINFORMATIONFEBRUARY04) of 65,000 records with the entries in a lost savings table (TBLCCYEARTOTALS) of 1,939 records. This is the View query:
SELECT dbo.TBLCCYEARTOTALS.*, dbo.TBLCCINFORMATIONFEBRUARY04.EVPREPORTNAME AS EVPREPORTNAME
FROM dbo.TBLCCYEARTOTALS INNER JOIN
dbo.TBLCCINFORMATIONFEBRUARY04 ON dbo.TBLCCYEARTOTALS.VPAWID = dbo.TBLCCINFORMATIONFEBRUARY04.VPAWID
The view is returning 2,516,488 records, and I can see the same data repeating over and over again. What am I doing to create these additional records?
My guess is that you only included one column of your primary key in the join. If the same value existed for the VPAWID column in every row of both tables, you could get 126+ million rows in your result set.