抱歉,刚刚没描述清楚。我要把查出的两个结果集合并成一个结果集(字段相同),要求相同数据合并成一条(不是去重复,因为满足条件的数据字段有些有值有些没有),不相同的数据也要在合并结果集里面
INSERT INTO TB1 FROM TB2 WHERE XXX="123"
insert into A1 select * from A2 where case =??
表T_A,T_B 分别有id,a,b两个字段;SQL参考如下,改为你自己的表和字段啊
insert into T_B (a,b) (select a , b from T_A ta where 条件)
update T_B tb ,(select a , b from T_A ) ta set tb.a = ta.a , tb.b = ta.b where ta.id = tb.id and 其他条件
满足和不满足都是条件,把这个两个表按照条件查询后union一下
insert into a ( select * from b union a where 满足的条件) ;
insert into a ( select * from b union a where 不满足的条件) ;
insert into table3 as select * from table1 a where not exists(select * from table2 b where a.id=b.id)
测试过没问题。楼主可以试试。迫切需要分下载资源。求帮助。
创建临时表,合并两表数据 再按条件去重,保留一条。
直接在后面合并不就好了,注意满足字节长度就好