Finding value in consecutive rows

Last Post 25 Jun 2009 10:27 PM by SwePeso. 1 Replies.
AddThis - Bookmarking and Sharing Button Printer Friendly
  •  
  •  
  •  
  •  
  •  
Sort:
PrevPrev NextNext
You are not authorized to post a reply.
Author Messages
Balance
New Member
New Member

--
03 Jun 2009 09:29 AM
I have a table as such:

cid reason_cd date_entered
1 b 2008-08-26 14:31:00
1 d 2008-09-23 11:49:00
1 b 2008-09-23 13:54:00
1 t 2008-10-02 11:43:00
1 b 2008-10-03 12:07:00

And I need to get the count of cid where reason_cd = 'b' CONSECUTIVELY.
So, SELECT COUNT(cid) FROM Table1 WHERE reason_cd = 'b' doesn't work because
it doesn't give me a count of the number of times cid has reason_cd = 'b' consecutively.

TIA
SwePeso
New Member
New Member

--
25 Jun 2009 10:27 PM
You want to count the number of "running streaks"?
You are not authorized to post a reply.

Acceptable Use Policy