title: Sql Partitioning
body: <p>I have Sql Table data and i need to filter only the Consecutive dates blocks as i highlighted on image below..</p>
  
  <p><img src="https://i.stack.imgur.com/ONLNz.png" alt="enter image description here">.</p>
  
  <p>and i need to add custom rates for each row on that selected blocks(this rate can display with separate column on out put).If there is more than 6 rows captured then $200 apply for each column of that block.if it is less than 6 ,it will be $125.The out put should be like this
  <img src="https://i.stack.imgur.com/3en1W.png" alt="enter image description here"></p>
  
  <p>And it should group by EmpID.
  i need to get the out put using MSSQL. Can any one help me</p>
  
  <p>this is what i have done through the sql view</p>
  
  <pre><code>ALTER   view [dbo].[vw_Test2] AS
  
  SELECT   
           tbl2.ID as Tbl2ID,
           tbl1.[EmpID],
           tbl1.[ExpInDateTime] as Tbl1ExpDate,
           tbl2.[ExpInDateTime] as Tbl2ExpDate,
              case when(CONVERT(date,tbl1.[ActInDateTime]) = CONVERT(date, DATEADD(DAY,1,tbl2.[ExpInDateTime]))) then
                   1
              else 0 
              end as Token
  from [dbo].[vw_Test] tbl1 join [dbo].[vw_Test]  tbl2 
  on tbl1.ID=(tbl2.ID+1) 
  GO
  </code></pre>
  
  <p>only thing is i have to do this using SQL views</p>