(original) MySQL error 1093 you can ' t specify target table ' Wms_cabinet_form ' for update in FROM clause

Source: Internet
Author: User

This error means that you cannot select some of the values in the same table, then update the table (in the same statement), the solution does not directly query the same, assuming that the table to be updated to a, the data of a is first put to table B, and then query from table B to get updated and query table a effect

Cases:

Score Table:

Change the grade of the "Yao" teacher taught in the "SC" table to the average grade of this course

Update SC Set score= (select AVG (a.score) from (select Score,c to SC) a where A.C in (select C from Course l EFT Join teacher on course. T=teacher. T where Tname= ' Yao ') group by A.C) where C in (select C from course left join teacher on course. T=teacher. T where Tname= ' Yao Ming ')

Where the red font will put the SC data into a temporary table A, and then query the table A

(original) MySQL error 1093 you can ' t specify target table ' Wms_cabinet_form ' for update in FROM clause

Related Article

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.