日期:2014-05-18 浏览次数:20489 次
insert table1(zd1,zd2) select zz,dd from table2 a,table3 b where a.关键字段=b.关键字段
------解决方案--------------------
insert table1(zd1,zd2) select zz,dd from( select px=row_number()over(order by getdate()),zz from table2)a full join ( select px=row_number()over(order by getdate()),dd from table3)b on a.px=b.px
------解决方案--------------------
insert into table1(zd1)
select zz from table2
insert into table1(zd2)
select dd from table3
------解决方案--------------------
update table1 set zd1=(SELECT zz FROM table2 WHERE tt='asd')
update table1 set zd2 = (SELECT dd FROM table3 WHERE kk='jkl')
------解决方案--------------------
路过,这三张表应该有关联的。
就用这条语句:
INSERT INTO table1(zd1,zd2) SELECT zz,dd FROM table2 a , table3 b WHERE a.tt='asd' and b.kk='jkl'