表中有id,pbillno,A,B,C,D这几个字段,id的值为1到7 id=1这记录的ABCD 复制到id=0的记录中 pbillno字段相同的
表中有id,pbillno,A,B,C,D这几个字段,id的值为1到7 id=1这记录的ABCD 复制到id=0的记录的ABCD中 其中pbillno字段相同的
你这是在同一个表中吗?
追答是同一个表,不过么有写全,入校:
update tab set a=tab2.a,b=tab2.b,c=tab2.c,d=tab2.d
from (select a,b,c,d,id from tab where id = 1) tab2
where id = 0