我想使用单个查询从 4 个表中删除数据。
delete e1,e2,e3,e4 FROM sas.RolesInMenuOperations as e1 INNER JOIN
sas.RolesMenus as e2 ON e1.RoleMenuId = e2.Id INNER JOIN
sas.RolesInModules as e3 ON e2.RolesInModulesId = e3.Id INNER JOIN
sas.Roles as e4 ON e3.RoleId = e4.Id
where e4.Id=5
这是我到目前为止所做的。我正在引用此链接是否可以使用联接从 4 个表中删除数据。如何实现这一点,或者我想编写 4 个不同的查询?
尽管此查询正常工作
delete e1 FROM sas.RolesInMenuOperations as e1 INNER JOIN
sas.RolesMenus as e2 ON e1.RoleMenuId = e2.Id INNER JOIN
sas.RolesInModules as e3 ON e2.RolesInModulesId = e3.Id INNER JOIN
sas.Roles as e4 ON e3.RoleId = e4.Id
where Roles.Id=5