title: Merge rows based on date in SQL Server
body: <p>I want to display data based on start date and end date. a code can contain different dates. if any time intervel is continues then I need to merge that rows and display as single row
  Here is sample data</p>
  
  <pre><code>Code  Start_Date   End_Date     Volume
  470   24-Oct-10    30-Oct-10    28
  470   17-Oct-10    23-Oct-10     2
  470   26-Sep-10     2-Oct-10     2
  471   22-Aug-10    29-Aug-10     2
  471   15-Aug-10    21-Aug-10     2
  </code></pre>
  
  <p>The output result I want is  </p>
  
  <pre><code>Code  Start_Date   End_Date     Volume
  470   17-Oct-10    30-Oct-10    30
  470   26-Sep-10     2-Oct-10     2
  471   15-Aug-10    29-Aug-10     4
  </code></pre>
  
  <p>a code can have any no. of time intervels. Pls help. Thank you</p>