select '年龄<35',count(*) from A where 年龄<35
union all
select '35<=年龄=<50',count(*) from A where 年龄>=35 and 年龄>=35
union all
select '50<=年龄',count(*) from A where 年龄>=50

解决方案 »

  1.   

    select '年龄<35',count(*) from A where 年龄<35
    union all
    select '35<=年龄=<50',count(*) from A where 年龄>=35 and 年龄<=50
    union all
    select '50<=年龄',count(*) from A where 年龄>=50
      

  2.   


    select [年龄段]='年龄<35',[人数]=(select count(1) from table1 where 年龄<35)
    union all 
    select '35=<年龄=<50',(select count(1) from table1 where 年龄>=35 and 年龄<=50)
    union all 
    select '50<=年龄',(select count(1) from table1 where 年龄>=50)
    ...