异常:nested exception is java.sql.SQLSyntaxErrorException: Unknown table ‘ORGDATA’ in MULTI DELETE
错误代码
<delete id="deleteBatchEnergy">
delete ORGDATA,OEDRESOURCE
from ORGDATA AS g
LEFT JOIN OEDRESOURCE e
ON g.OEDID = e.OEDERID
where(g.ORGID,g.DICTEID,g.YEAR) in
<foreach collection="list" item="dto" open="(" separator="," close=")">
(#{dto.orgid},#{dto.dicteid},#{dto.year})
</foreach>
</delete>
正确代码
声明了表的别名,必须使用这个别名
<delete id="deleteBatchEnergy">
delete g,e
from ORGDATA AS g
LEFT JOIN OEDRESOURCEe
ON g.OEDID = e.OEDERID
where(g.ORGID,g.DICTEID,g.YEAR) in
<foreach collection="list" item="dto" open="(" separator="," close=")">
(#{dto.orgid},#{dto.dicteid},#{dto.year})
</foreach>
</delete>