应该这样写,但是要保证column1和column2取出来的值是唯一的,否则要加上top 1
update table1 set colum1= (select colum1 from table2 where condition1) ,
colum2= (select colum2 from table2 where condition1)
WHERE condition2
update table1 set colum1= (select colum1 from table2 where condition1) ,
colum2= (select colum2 from table2 where condition1)
WHERE condition2
update table1 set table1.colum1=table2.colum1,
table1.colum2=table2.colum2
from table1 join table2 on 連接條件
WHERE condition2
set colum1 = (select colum1 from table2 where condition1) ,
colum2 = (select colum2 from table2 where condition1)
WHERE condition2
--or
update a
set a.colum1 = b.colum1,
a.colum2 = b.colum2
from table1 a ,table2 b
WHERE .........
insert into table1(col1,col2) values(select col1,col2 from table2 ) where....
from table1 as a,(select colum1,colum2 from table2 where condition1) as b
WHERE condition2
select col1,col2 from table2 where conditions
where conditions2
请问这样可以吗。我用了总是不得,但语法查检又没有提示错误。
select col1,col2 from table2 where conditions
select t1.col1,t2.col2 from table1 as t1,table2 as t2 where (t1.col1=t2.col2)
这样就可以