如我有表
Name Code Price
A A1 11
B B2 32
C C1 45
D E1 11
--------------------
然后我现在要更新所有的Code和Price都为Name=D的Code和Price谢谢
Name Code Price
A A1 11
B B2 32
C C1 45
D E1 11
--------------------
然后我现在要更新所有的Code和Price都为Name=D的Code和Price谢谢
where name='d'
PRICE=(SELECT TOP 1 PRICE FROM TB WHERE NAME='D')
update tb set code=(select code from tb where [name]='D'),
price=(select code from tb where [name]='D')
update tb set code=(select code from tb where [name]='D'),
price=(select price from tb where [name]='D')
update tb set code=(select min(code) from tb where [name]='D'),
price=(select min(price) from tb where [name]='D')
from a inner join b on a.name=b.name
where a.name='D'