MyBatis 中将 "AND pee.id not in" 改为 "AND NOT EXISTS" 的方法
要将"AND pee.id not in"改为"AND NOT EXISTS",可以使用子查询来实现。以下是修改后的SQL语句:
AND NOT EXISTS (
SELECT 1
FROM your_table_name AS pee2
WHERE pee2.id IN (
<foreach collection="ids" item="item" open="(" close=")" separator=",">
#{item, jdbcType=VARCHAR}
</foreach>
)
)
原文地址: https://www.cveoy.top/t/topic/pVmP 著作权归作者所有。请勿转载和采集!