如何将不同的记录从表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