title: "ORDER BY items must appear in the select list if SELECT DISTINCT" when selecting from aliased subquery
body: <p>Getting this error from running this query:</p>
  
  <pre><code>SELECT DISTINCT TOP 100 
      T.Number,
      T.LastName, 
      T.FirstName
  FROM
  (
      SELECT TOP 1700 -- 100 * (mean avg # site per PI + 3sd)
          PI.Number,  
          PI.LastName, 
          PI.FirstName
      FROM
          Sites S
      INNER JOIN  
          PI
      ON
          S.PI = PI.Number
      INNER JOIN 
          Protocol P 
      ON 
          PI.ProtocolNumber = P.ProtocolNumber
      INNER JOIN 
          ProductMaster PM 
      ON 
          PA.productcode = PM.productcode
      WHERE
          -- predicates
  ) T     
  ORDER BY
      T.LastName COLLATE Latin1_General_CI_AI
  </code></pre>
  
  <p>I'm not sure why this isn't working. I've got the last name in the select list. What am I missing?</p>