SQL 根据 idx = 1 里面的条件找到 idx = 2, 然后删除的语句怎么写? 财富值29

2016-10-31 11:55发布

按理说,应该从 下面的两个select SQL中取一个得到idx,然后再执行
delete from user where idx in (xxx,xxx);即可

但是,我想一次性删除,即不再另外运行一条 delete from语句

get的两条语句均可以。但是将里面的
select * from
改为 delete from 就不成功了,

delete from user b join (select * from user a where idx in (29,35)) c on (b.source_user = c.source_user and b.target_user = c.target_user) or (b.source_user = c.target_user and b.target_user = c.source_user);
select a.*  from user a join user b  on  ((b.source_user = a.source_user and b.target_user = a.target_user) or (b.source_user = a.target_user and b.target_user = a.source_user))  where b.idx in (29,35); 
select b.*  from user b  join (select * from user a where idx in (29)) c  on (b.source_user = c.source_user and b.target_user = c.target_user) or (b.source_user = c.target_user and b.target_user = c.source_user)
友情提示: 问题已经关闭,关闭后问题禁止继续编辑,回答。
该问题目前已经被作者或者管理员关闭, 无法添加新回复
0条回答

一周热门 更多>