Mysql EXISTS代替IN写法提升效率
IN语句:SELECT * FROM order WHERE status IN (1,2,3)EXISTS语句转换:SELECT * FROM order a WHERE EXISTS( SELECT * FROM ( SELECT 1 AS type UNION ALL SELECT 2 AS type UNION ALL SELECT 3 AS type ) b WHERE b.type=a.type)该代码用到了临时结果集的概念...
原创
2021-08-09 12:26:07 ·
1841 阅读 ·
0 评论