update table set d1=d1+(select d1 from table where id='0002'),
d2=d2+(select d2 from table where id='0002'),
d3=d3+(select d3 from table where id='0002'),
d4=d4+(select d4 from table where id='0002'),
d5=d5+(select d5 from table where id='0002') 
where id='0001'

解决方案 »

  1.   

    在 visual foxpro中的command窗口中的代码怎么写,以上的代码在foxpro中好象不行
      

  2.   

    下面代码在 visual foxpro 通过测试。create cursor test(id c(3) UNIQUE,d1 int,d2 int,d3 int,d4 int,d5 int)
    insert into test(id,d1,d2,d3,d4,d5) values('001',2,3,3,6,7)
    insert into test(id,d1,d2,d3,d4,d5) values('002',6,9,5,2,6)
    set order to id
    go top
    seek '002'
    scatter memvar
    go top
    seek '001'
    replace d1 with d1+m.d1,d2 with d2+m.d2,d3 with d3+m.d3,d4 with d4+m.d4,d5 with d5+m.d5
      

  3.   

    select "001" as id,sum(dl) as dl,sum(d2) as d2,sum(d3) as d3,sum(d4) as d4,sum(d5) as d5,这样就行了