这样 delete a,b from A a,B b where 1=1 and a.itemid=b.itemid and a.id<5 或者是这样 delete from a,b using A a,B b where 1=1 and a.itemid=b.itemid and a.id<5
from 中的表的名称没有先后顺序的要求,以下为<Sams - Mysql Tutorial(2003).chm>中的说明:
delete 语法:
DELETE[LOW_PRIORITY][QUICK]FROM table_name [WHERE where_definition] [ORDER BY ...] [LIMIT rows] or DELETE[LOW_PRIORITY][QUICK] table_name[.*][, table_name[.*] ...] FROMtable-references [WHERE where_definition] or DELETE[LOW_PRIORITY][QUICK] FROM table_name[.*][, table_name[.*] ...] USING table-references [WHERE where_definition]
示例代码为:
1. 删除一个表中的数据 deletefrom department where name='Asset Management'; 2. 删除两个表中的数据 delete employee, employeeSkills from employee, employeeSkills, department where employee.employeeID = employeeSkills.employeeID and employee.departmentID = department.departmentID and department.name='Finance'; 3. 删除两个表中的数据,用using语法 deletefrom employee, employeeSkills using employee, employeeSkills, department where employee.employeeID = employeeSkills.employeeID and employee.departmentID = department.departmentID and department.name='Finance';