日期:2014-05-16  浏览次数:20966 次

问一个mysql的sql语法问题,谢谢
select   *   from   my_GroupUser   t1
  where   exists(select   *   from   my_group   t0   where   t0.id=14   and   t0.id=t1.groupId)

delete   from   my_GroupUser   t1
  where   exists(select   *   from   my_group   t0   where   t0.id=14   and   t0.id=t1.groupId)

为什么前面那句sql能执行成功,
而后面那句就错误?

区别只是一个select,一个delete,请指点一下


------解决方案--------------------
MYSQL在刪除記錄時表好像不可以用別名
------解决方案--------------------
学习了
------解决方案--------------------
--try


delete my_GroupUser
from my_GroupUser t1
where exists(select * from my_group t0 where t0.id=14 and t0.id=t1.groupId)





delete t1
from my_GroupUser t1
where exists(select * from my_group t0 where t0.id=14 and t0.id=t1.groupId)