I have below table
create table #t (Id int, Name char) insert into #t values (1, \'A\'), (2, \'A\'), (3, \'B\'), (4, \'B\'), (5, \'B\'), (6, \'B\'), (7, \'C\