
一个统计的语句大家看看。
select seg, count(men) as men, count(women) as women, (count(men)+count(women))as total from table1 group by ((age-1)\\\/10) as seg
如何写出相应的统计语句?
写个存储过程将行拆分为列放入到临时表后再统计吧。
比如1 a,b,c,d拆分为4列:1 a1 b1 c1 d然后对临时表进行统计select pro,count(1) from tb group by pro这是最好的办法



