title: Join Results Not Matching Expectation
body: <p>I feel ridiculous having to ask this but I've been staring at my code now for so long and I can't see what obvious answer I'm missing:</p>
  
  <p>Using AdventureWorks2016 database I have the following query:</p>
  
  <pre><code>declare @OrderFrequency table (CustomerID int, OrderYear int, OrderFrequency int)
  
  ;with OrderFrequency as
  (
  
  Select
        CustomerID,
        datepart(month, OrderDate) OrderMonth,
        datepart(year, OrderDate) OrderYear,
        cast(datepart(month, OrderDate) as nvarchar) +'/'+cast(datepart(year, OrderDate) as nvarchar) MonthYearCode
  from Sales.SalesOrderHeader
  group by CustomerID, datepart(month, OrderDate), datepart(year, OrderDate)
  
  )
  insert into @OrderFrequency
  Select CustomerID, OrderYear, count(distinct MonthYearCode) OrderFrequency
  from OrderFrequency
  group by CustomerID, OrderYear
  order by CustomerID, OrderYear
  
  
  declare @CTETable table (CustomerID int, OrderTotal float, OrderMonth int, OrderYear int)
  ;with CTE as
  (
  Select
        CustomerID,
        sum(TotalDue) OrderTotal,
        datepart(month, OrderDate) OrderMonth,
        datepart(year, OrderDate) OrderYear
  from Sales.SalesOrderHeader
  group by CustomerID, datepart(month, OrderDate), datepart(year, OrderDate)
  
  )
  insert into @CTETable
  select * from CTE
  
  Select CTET.*
  from @CTETable CTET
  left outer join @OrderFrequency Ord on Ord.CustomerID = CTET.CustomerID
  order by CTET.CustomerID, CTET.OrderYear
  </code></pre>
  
  <p>My final select statement is returning all from CTET, with extra rows returned from the join on @OrderFrequency. </p>
  
  <p>Should my specification of CTET.* return ONLY CTET?</p>