title: Select random rows and stop when a specific sum/total is reached
body: <p>I'm using SQL Server 2012 and I'm trying to do something like this:</p>
  
  <pre><code>SELECT SUM(MILES) from tblName WHERE 
  mDate &gt; = '03/01/2012' and 
  mDate &lt;= '03/31/2012' 
  -- and...
  /* 
     now I want to add here do until the SUM of Miles 
     is equal to or greater then '3250' and get the 
     results rows randomly
  */
  </code></pre>
  
  <p>So in other words, I want to select random rows from a table that have a specified from and to date and stop when the sum of miles is at or over the number: 3250</p>