title: SQL Server Ranking - Ignoring Duplicate Row Values
body: <p>I'm hoping someone can point me in the right direction here.  I have a unique requirement with regards to ranking records in a SQL Server table.  The table looks like this...
  <a href="https://i.stack.imgur.com/Z4xHS.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Z4xHS.png" alt="Status Change Table"></a></p>
  
  <p>This table shows a member of a health club and their various status changes (A = Active, C = Canceled).  I want to rank these status changes in a unique way.  I'd like to first A record to be 1 and then ignore the next 3 A records.  The first C record would then be ranked 1 as well and the following A record would have a rank of 2.  Again, I would want to ignore the following 3 A records before the next C record.</p>
  
  <p>You're probably wondering why we are seeing multiple of the same statuses in a row with new to/from time periods.  This is b/c this came from a larger data set where other columns were actually changed while statuses stayed the same. My end goal is to only bring forward the relevant (ranked) rows and match up the Active/Canceled rows based on rank.  Then I would create an entirely new table/query to establish new From/To dates for the different periods.</p>
  
  <p>Thanks for any advice offered!!</p>