Solution to the delete left Join Operation

Source: Internet
Author: User

A solution for left join

Today, this problem occurs when you delete something in the background of a program:

Java code

  1. System message: MySQL query Error
  2. User: Admin
  3. Time: 2007-10-20 21:08:48
  4. Script:/k/admincp. php
  5. [U] SQL: delete from Table1 T left join Table2 f using (ID) Where F. typeid = 1 [/u]
  6. Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL Server version for the right syntax to use near 'left join Table2 f using (ID) Where F. typeid = 1 'at line 1
  7. Errno: 1064

After searching for Google for about one hour, I finally found the cause on a foreign website, which is very simple to solve, tyyd

Java code
  1. Simply put the following SQL:
  2. Delete from Table1 T left join Table2 f using (ID) Where F. typeid = 1
  3. Modify the SQL statement as follows:
  4. Delete T. * From Table1 T left join Table2 f using (ID) Where F. typeid = 1

Add a T .. Not easy.

Fault Analysis: Because the insert, update, and delete parameters can only be operated on one table

Because left join is used in this delete operation, the program causes the delete operation on two tables. Therefore, this problem occurs.

Transferred from: personbeta.iteye.com/blog/890340

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.