我有一个表里面有一些数据行另外一个表是没有的。我想把这个表的数据行更新插入到另外一个表上面去。
例如:name code values
I 1 12
U 1 11
上面这个表还有很多字段没加上去的。但是对另外一个表没多大用处我就想插这几个字段的数据行进去另外一个表。请问高手我要怎么做呢?
例如:name code values
I 1 12
U 1 11
上面这个表还有很多字段没加上去的。但是对另外一个表没多大用处我就想插这几个字段的数据行进去另外一个表。请问高手我要怎么做呢?
调试欢乐多
insert a
select * from b
where exists(select * from a where name=b.name and code=b.code and values=b.values)
insert a
select * from b
where not exists(select * from a where name=b.name and code=b.code and values=b.values)