mybaties處理mysql刪除(子查詢結果集報錯)

錯誤: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不支持。
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章