title: TSQL order data according to dates
body: <p>Hi and thank you for your response in advance. I am new to TSQL and currently in an internship. 
  I am creating a web page using VB and I have no problem displaying what is in the first table below 
  to the user. </p>
  
  <pre><code>----------Name--------------------Date----------------Points
  
  1--------Mike---------------------10/01/2012----------4
  
  2--------Mike---------------------10/05/2012----------2
  
  3--------Mike---------------------10/03/2012----------1
  
  4--------Mike---------------------10/17/2012----------4
  
  5--------Mike---------------------10/24/2012----------4
  
  6--------Simon---------------------11/05/2012--------1
  
  7--------Simon---------------------11/11/2012--------3
  
  8--------Simon---------------------11/20/2012--------4
  
  9--------Simon---------------------11/22/2012--------2
  
  10  Simon   11/27/2012  3
  </code></pre>
  
  <p>However, I have a drop down list with day and week which sorts the Data from the first 
  table above on a day to day or week to week interval. </p>
  
  <p>Output when user selects to display data in weekly intervals starting from the <code>MIN(Date)</code> to 
  <code>MAX(Date)</code> for each Name in table should be like this. I use</p>
  
  <pre><code>SELECT  Name, MIN(Date) AS StartDate, DATEADD(DD, 7, MIN(Date)) AS EndDate, SUM(Points) 
  </code></pre>
  
  <p>And I know I shouldnt set the EndDate to a fixed point like that because then the next 7 days
  of data will not show. </p>
  
  <pre><code>-----Name-------StartDate-------EndDate---------Points
  
  1----Mike-------10/01/2012------10/05/2012----------7
  
  2----Mike-------10/17/2012------10/24/2012----------8
  
  3----Simon-----11/05/2012-----11/11/2012----------4
  
  4----Simon-----11/20/2012-----11/27/2012----------9
  </code></pre>
  
  <p>Any help will be much appreciated. I hope I was clear in my question. Thanks!</p>