明白你的意思,但有一个问题,按你说的意思,好象除了0或1开头,不会再有其它开头的了,是不是这样?若不是那又是什么规律呢?update tableA
set val1=(select sum(val1) from tableA t1 where left(id,1)='0')
,val2=(select sum(val2) from tableA t2 where left(id,1)='0')
where left(id,1)='1'