title: SQL PIVOT SELECT FROM LIST (IN SELECT)
body: <p>Is it possible to do a PIVOT and select list from a table, instead of using single values?</p>
  
  <p>Like this (incorrect syntax error):</p>
  
  <pre><code>SELECT *
  FROM (
      SELECT RepID, MilestoneID, ResultID FROM RM
  ) AS src
  PIVOT (
      MAX(ResultID) FOR MilestoneID IN  (SELECT id FROM m) 
  ) AS pvt
  </code></pre>
  
  <p>This one compiles, but doesn't work for me:</p>
  
  <pre><code>SELECT *
  FROM (
      SELECT RepID, MilestoneID, ResultID FROM RM
  ) AS src
  PIVOT (
      MAX(ResultID) FOR MilestoneID IN  ([1], [2], [3], [4]) 
  ) AS pvt
  </code></pre>
  
  <p>PS: I do NOT want to use dynamic SQL, is there a way to do this without using dynamic SQL?</p>