how to fetch continuous occurrence count of a column value in sql?
问题 I have added one more id column for the order purpose, if the table is like this +-----+-------+ | id | cs_id | +-----+-------+ | 1 | a | | 2 | b | | 3 | a | | 4 | a | | 5 | a | | 6 | b | | 7 | b | | 8 | b | | 9 | b | +-----+-------+ i want the continuous occurrence of cs_id order by id column +-----+-------+--------------------------------- | id | cs_id | continuous_occurrence_cs_id +-----+-------+---------------------------------| | 1 | a | 1 | 2 | b | 1 | 3 | a | 1 | 4 | a | 2 | 5 | a | 3