A solution for left join
Today, this problem occurs when you delete something in the background of a program:
Java code
- System message: MySQL query Error
- User: Admin
- Time: 2007-10-20 21:08:48
- Script:/k/admincp. php
- [U] SQL: delete from Table1 T left join Table2 f using (ID) Where F. typeid = 1 [/u]
- 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
- 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
- Simply put the following SQL:
- Delete from Table1 T left join Table2 f using (ID) Where F. typeid = 1
- Modify the SQL statement as follows:
- 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