如何将不同的记录从表A插入表B(两个表具有相同的结构) [英] How to insert Distinct Records from Table A to Table B (both tables have same structure)
本文介绍了如何将不同的记录从表A插入表B(两个表具有相同的结构)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我只想将表 A中的不同记录插入表 B中。假定两个表都具有相同的结构。
I want to insert only Distinct Records from Table "A" to Table "B". Assume both the tables has same structure.
推荐答案
INSERT INTO B SELECT DISTINCT * FROM A
您可能不希望表的id列成为唯一检查的一部分,因此请使用在这种情况下的解决方案: https://stackoverflow.com/a/5171345/453673
You might not want the id column of the table to be part of the distinct check, so use this solution if that's the case: https://stackoverflow.com/a/5171345/453673
这篇关于如何将不同的记录从表A插入表B(两个表具有相同的结构)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文