update table set Field2=asum,Field3=bsum,Field4=csumfrom table a,(select Field1='单位1'sum(field2) as asum,sum(field3) as bsum,sum(field4) as csum from table) b where a.Field1=b.Field1
sorry! ------- update table set Field2=asum,Field3=bsum,Field4=csumfrom table a,(select Field1='单位1'sum(field2) as asum,sum(field3) as bsum,sum(field4) as csum from table where Field1 in ('单位2','单位3')) b where a.Field1=b.Field1
如果单位1的数据都不要的话就可以象上面一样. 或 update table set field1 = '单位1',Field2= sum(field2) from table where field1 in ('单位2','单位3'),Field3= sum(field3) from table where field1 in ('单位2','单位3'),Field4= sum(field4) from table where field1 in ('单位2','单位3')
-------
update table set Field2=asum,Field3=bsum,Field4=csumfrom table a,(select Field1='单位1'sum(field2) as asum,sum(field3) as bsum,sum(field4) as csum from table where Field1 in ('单位2','单位3')) b
where a.Field1=b.Field1
或
update table set field1 = '单位1',Field2= sum(field2) from table where field1 in ('单位2','单位3'),Field3= sum(field3) from table where field1 in ('单位2','单位3'),Field4= sum(field4) from table where field1 in ('单位2','单位3')