MySQL or 加子查询全表扫描问题

目录

示例1:

示例2:

结果: 

解决:


示例1:

select * from a where a.id = 0 and a.field2 = 3 or id in (

select id from a where a.field3 > 3 and a.field3 < 4
)

示例2:

select * from a where a.id = 0 and a.field2 = 3 or id in (

3,4,5
)

猜你喜欢

转载自blog.csdn.net/u010734852/article/details/125497848
今日推荐