日期:2014-05-17 浏览次数:20520 次
---有这样一个表 create table b (valuess int , classfiy int , companyid int) insert into b select 3,1,1 union all select 4,1,1 union all select 5,1,1 union all select 5,2,1 union all select 7,2,1 union all select 5,2,1 union all select 5,3,1 union all select 7,3,1 union all select 8,3,1 union all select 4,1,2 union all select 5,1,2 union all select 5,2,2 union all select 7,2,2 union all select 5,2,2 union all select 5,3,2 union all select 7,3,2 union all select 8,3,2 ----运行了这下面段出结果 select SUM(valuess)vvvvv from b y group by companyid,classfiy order by companyid