create table #t (Id int, Name nvarchar(max))
insert into #t
values (1, 'ABC'), (2, 'ABC'), (3, 'BBB'), (4, 'BBB'),
(5, 'BBB'), (6, 'BBB'), (7, 'CCC'), (8, 'BBB'),
(9, 'BBB'), (10, 'ABC')
I want to count values in name column if there are only in sequence form how I get this result as shown in table below:
| Name | Repetition |
('ABC'), 2
('ABC'), 2
('BBB'), 4
('BBB'), 4
('BBB'), 4
('BBB'), 4
('CCC'), 1
('BBB'), 2
('BBB'), 2
('ABC'), 1