title: The column "xxxx" was specified multiple times for "CTE_YYYY"
body: <p>I am new to Microsoft SQL Server. I am trying to join two tables that has common key named <code>CampaignID</code> using <code>LEFT OUTER JOIN</code>. I need to reuse the result in a different query, so I decided to capture the result set using <code>CTE_Results</code>. For example,</p>
  
  <pre><code>-- This is my CTE script
  WITH CTE_Results AS
  (
    SELECT t1.CampaignID, t2.CampaignID, t1.Name, t2.Vendor
    FROM CampaignDetails AS t1
    LEFT OUTER JOIN CampaignOnlineDetails AS t2
    ON t1.CampaignID = t2.CampaignID
  )
  
  -- This is the script I want to use to compare the resulting table. For example,
  SELECT Vendor
  FROM CTE_Results
  </code></pre>
  
  <p>However, when I ran above, I get:</p>
  
  <pre><code>The column `CampaignID` was specified multiple times for `CTE_Results`. 
  </code></pre>
  
  <p>From reading through old StackOverflow questions and answers, it seems like since <code>CampaignID</code> is in both tables that are being joined, I must use table aliases to specify whose (which table's) <code>CampaignID</code> I want to <code>SELECT</code>. But I think I did that and even that it seems like the error still occurs. </p>
  
  <p>Is there a way for me to select and keep BOTH CampaignID's in my CTE? If so, what should be changed? Thank you for the answers!</p>