Trouble with Group By Sequence Numbers
===

I am basically after sql that will do the following. I am after a sequential set of numbers in relation to when column B changes but keeping column ID in sequence
I have tried Dense Rank but it always throws out the sequence of the ID column which messes what I am after. Any ideas?

ID||A||B

01||T||1

02||T||1

03||T||0

04||T||0

05||T||1

06||T||1

07||T||1

08||T||0

09||T||1

10||T||1

11||T||0

INTO

ID||A||B||C

01||T||1||1

02||T||1||1

03||T||0||2

04||T||0||3

05||T||1||4

06||T||1||4

07||T||1||4

08||T||0||5

09||T||1||6

10||T||1||6

11||T||0||7


