如何将表 A 中的不同记录插入表 B(两个表具有相同的结构) [英] How to insert Distinct Records from Table A to Table B (both tables have same structure)

查看:28
本文介绍了如何将表 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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆