title: Selecting multiple tables from single table by distinct column value in stored procedure
body: <p>I have a bit of a conundrum I need to deal with, and I'm trying to find a good solution to it.  I'm using MS SQL server 2005, and given a table where a uniqueidentifier column contains a data key to other information on the server.  What I need to do is select every row in this datatable (sproc from ASP.NET), but separated into tables based on this one column.  For example, from</p>
  
  <pre><code>------------------------------------
  MyID    |  MyOtherData
  ------------------------------------
   4         asdf
   4         test
   3         qwerty
   2         morestuff
  </code></pre>
  
  <p>I'd want the following three tables returned:</p>
  
  <pre><code>------------------------------------
  MyID    |  MyOtherData
  ------------------------------------
   4         asdf
   4         test
  
  ------------------------------------
  MyID    |  MyOtherData
  ------------------------------------
   3         qwerty
  
  ------------------------------------
  MyID    |  MyOtherData
  ------------------------------------
   2         morestuff
  </code></pre>
  
  <p>How would be the best way for me to go around this, if I don't know how many unique MyID values there will be ahead of time?</p>