请教一个在delete语句中inner join的问题
--通过
select privilege_id from role_privilege rp
inner join role_info ri on ri.id=rp.role_id
inner join admin_role ar on ri.id=ar.role_id
where ar.admin_id=3000;
--报“ORA-00933:SQL命令未正确结束”
delete from role_privilege rp
inner join role_info ri on ri.id=rp.role_id
inner join admin_role ar on ar.role_id=ri.id
where ar.admin_id=3000;
--换用子查询可以删除数据
delete from role_privilege where role_id=
(select role_id from admin_role where admin_id=3000);
--感觉第二条SQL原理上可行的啊,不知道哪错了,还望指教。
------解决方案--------------------ORACLE 好像不支持关联表的DELETE 和 UPDATE ,可以用子查询来实现
MS 好像支持
------解决方案--------------------oracle不支持这样
delete from role_privilege rp
inner join role_info ri on ri.id=rp.role_id
inner join admin_role ar on ar.role_id=ri.id
where ar.admin_id=3000;
一般都用子查询进行连表