select fields3,fields4 from
(select id=min(id),fields3,fields4=sum(fields4) from tb group by fields3)a
order by id

解决方案 »

  1.   

    create table tb(id int, Name varchar(10),fields3 numeric(10),fields4 numeric(12,1))
    Insert into tb 
    select '2','aa','124','22.9'
    union all select '4','bb','653','61.0'
    union all select '5','cc','124','92.0'
    union all select '6','dd','653','33.0'
    union all select '11','ee','103','51.5'select fields3,fields4 from
    (select id=min(id),fields3,fields4=sum(fields4) from tb group by fields3)a
    order by id--結果
     fields3  fields4
    --------------------
    124 114.9
    653 94.0
    103 51.5