H haodan110 Unregistered / Unconfirmed GUEST, unregistred user! 2006-09-25 #1 有年龄、个人编号两个字段,要求出年龄在10~20,30~40,50~60的人数,新手上路,大家帮帮,小妹谢过
B breezee Unregistered / Unconfirmed GUEST, unregistred user! 2006-09-25 #4 select 年龄/10*10,count(*) from table1 group by 年龄/10*10 select 年龄/20*20,count(*) from table1 group by 年龄/20*20
select 年龄/10*10,count(*) from table1 group by 年龄/10*10 select 年龄/20*20,count(*) from table1 group by 年龄/20*20
X xiammy Unregistered / Unconfirmed GUEST, unregistred user! 2006-09-25 #5 SELECT Round(p.Age/10)*10 AS 年龄, Count(*) AS 人数 FROM p GROUP BY Round(p.Age/10);
D deardai Unregistered / Unconfirmed GUEST, unregistred user! 2006-09-25 #6 select sum(case when age>=10 and age <=20 then 1 else 0 end) as aa, sum(case when age>=30 and age <=40 then 1 else 0 end) as bb, sum(case when age>=50 and age <=60 then 1 else 0 end) as cc from tablename
select sum(case when age>=10 and age <=20 then 1 else 0 end) as aa, sum(case when age>=30 and age <=40 then 1 else 0 end) as bb, sum(case when age>=50 and age <=60 then 1 else 0 end) as cc from tablename
H haodan110 Unregistered / Unconfirmed GUEST, unregistred user! 2006-09-25 #7 谢谢.由于论坛出错,我以为信息没发出去,让大家久等,sorry