两表字段相同 第一列都是自增列 如何更新一行 create table a
(
a int identity(1,1),
b int ,
c int
)
go
insert into a select 1,2
union all select 2,3
union all select 3,4create table b
(
aa int identity(1,1),
bb int,
cc int
)
go
insert into b select 11,22
union all select 22,33
union all select 33,44select * from a
select * from b我要的不是一个一个列名的对比
最好有那种update a set * = (select * from b where aa=a.a) 的写法
(
a int identity(1,1),
b int ,
c int
)
go
insert into a select 1,2
union all select 2,3
union all select 3,4create table b
(
aa int identity(1,1),
bb int,
cc int
)
go
insert into b select 11,22
union all select 22,33
union all select 33,44select * from a
select * from b我要的不是一个一个列名的对比
最好有那种update a set * = (select * from b where aa=a.a) 的写法
up
update a set
b=bb,c=cc
from a, b
where a.a=b.aa