mybaties处理mysql删除(子查询结果集报错)

来源:互联网 发布:淘宝十字绣回收 编辑:程序博客网 时间:2024/05/17 06:13
错误:delete from table1 a WHERE a.table2_id in( select  b.id from table2 b where b.name = '-1' )

执行以上语句总是报错,原因是mysql在删除的时候,不支持别名定义,把别名去掉即可正常执行。

正确:delete from table1  WHERE table2_id in( select  id from table2 where name = '-1' )

oracle是支持的,mysql不支持。
0 0
原创粉丝点击