I want to insert only individual records from table "A" into table "B". Assume that both tables have the same structure.
INSERT INTO B SELECT DISTINCT * FROM A
You might not want the table id column to be part of a separate check, so use this solution if this is the case: fooobar.com/questions/1795809 / ...
INSERT INTO TableB (Col1, Col2, ...) SELECT DISTINCT Col1, Col2, ... FROM TableA
DISTINCT , TableB, A, :
DISTINCT
INSERT INTO TableB(Col1, Col2, Col3, ... , Coln) SELECT DISTINCT A.Col1, A.Col2, A.Col3, ... , A.Coln FROM TableA A LEFT JOIN TableB B ON A.KeyOfTableA = B.KeyOfTableB WHERE B.KeyOfTableB IS NULL
INSERT INTO TableB SELECT * FROM TableA AS A WHERE NOT EXISTS(SELECT * FROM TableB AS B WHERE B.Field1 = A.Field1) -- If need: B.Field2 = A.Field2 and B.Field3 = A.Field3
Source: https://habr.com/ru/post/1795809/More articles:Список сортировки, где объект IsNot Nothing - listhttps://translate.googleusercontent.com/translate_c?depth=1&pto=aue&rurl=translate.google.com&sl=ru&sp=nmt4&tl=en&u=https://fooobar.com/questions/1795805/apache-htaccess-forbidding-direct-access-to-a-file-but-allow-rewrites-to-go-there&usg=ALkJrhiNEt7aoiYCBX0dS3DmpGtUiGXyFgWhy is there a two-dimensional type error when calling WebMethod in an ASP.NET web application? - debuggingLost connection to MySQL server while "reading source communication packet", system error: 113 - phpAutomatically creating Piratespeak.po / gettext / translations for testing i18n? - pythonRequireJS: проблема, включающая jquery easing pack после оптимизации - javascriptPhantom update in Django admin - djangoHow to get all embedded document values using official C # driver for MongoDB? - c #TCP echo server that only drives off the first packet (C language) - cGoal c - Free Singleton Property - iosAll Articles