MySQL Query--go to heavy

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.