由于IN会使索引失效,有可以替换IN的其它函数和方法吗? 目前我能想到的是把 select * from A where ${if(len(city)==0,""," city in( '"+city+"')")} select * from A where city in ('成都','绵阳','自贡','南充','达州','乐山') 转换成这样: select * from A where city = '成都' or city = '绵阳' or city = '自贡' or city = '南充' or city = '达州' or city = '乐山' 但是如果OR不是争对于一个字段,也会索引失效; 如果select * from A where city = '成都' or city = '绵阳' or name= '自贡' OR引起的索引失效(特殊情况下:即不是同一个索引字段)NOT IN、NOT EXISTS导致索引失效我想要实现IN的功能,还有什么办法呢? |