title: Pivot tables - column alias not recognized in select statement
body: <p>I am trying to produce a pivoted table. <img src="https://i.stack.imgur.com/E0bbB.jpg" alt="I have a picture of the query and data here."> </p>
  
  <p>I have aliased column names, since the columns are being aggregated. </p>
  
  <p>Why isn't my alias usable? </p>
  
  <p><img src="https://i.stack.imgur.com/8cQup.jpg" alt="Here is a picture of the error message."></p>