INSERT into ' material ' (' id ', ' file_url ')
SELECT id,ekm. ' File_url '
From ' extmaterial ' as EKM
Left JOIN (SELECT ' file_url ' from ' material ' WHERE ' id ' = ID) as PM on PM. ' File_url ' = EKM. ' File_url '
WHERE EKM. ' ext_id ' = Extid and PM. ' File_url ' is NULL;
Comments:
This is a copy of the URL statement. The information in the 'extmaterial' table is copied to ' material ', but extmaterial has information that exists and does not exist in the material, so it needs to be weighed.
I am rather stupid, so in Chinese to understand SQL statements:
Insert INTO ' material ' (' a_id ', ' File_url ')-- inserts into material (' id ', ' file_url ')
SELECT aid,ekm. ' File_url ' from ' extmaterial ' as EKM--query in the extmaterial table (' id ', ' file_url ')
Left joins (SELECT ' file_url ' from ' material ' WHERE ' a_id ' = AId) as PM on PM. ' File_url ' = EKM. ' File_url '--Leftist (query The eligible File_url in C16>material as the result set ) alias to pm, leftist condition is pm. ' File_url ' = EKM. ' File_url ', this left The same URL is queried by the Union,
WHEREEKM.' ext_id ' = Extid and PM. ' File_url ' is NULL; -MakePM. ' File_url ' URLs (that is, duplicate URLs) are null, which is the compound EKM found when extmaterial . ' ext_id ' = The URL of the Extid condition and this URL equals PM. ' File_url ', which makes this data null, and does not insert data to achieve a deduplication effect
MySQL Query--de-weight