create table t3
(
id int
)
insert into t3( id) values (1);
insert into t3( id) values (2);
insert into t3( id) values (3);
insert into t3( id) values (4);
insert into t3( id) values (5);
insert into t3( id) values (6);
insert into t3( id) values (7);
insert into t3( id) values (8);
insert into t3( id) values (9);
insert into t3( id) values (10);
insert into t3( id) values (11);
insert into t3( id) values (12);
insert into t3( id) values (12);
insert into t3( id) values (13);
insert into t3( id) values (14);
insert into t3( id) values (15);
insert into t3( id) values (16);
insert into t3( id) values (17);
insert into t3( id) values (18);
insert into t3( id) values (19);
insert into t3( id) values (20);
select
COUNT (case when ID between 1 and 5 then 1 end ) as [1-5],
COUNT( case when id between 9 and 14 then 2 end ) as [9-14],
COUNT (case when id between 18 and 20 then 3 end ) as [18-20]
from t3