mysql多列 in多个字段优化sql语句

sql语句,例:

select a,b 
from test 
where (a = 1 and b = 2) 
   or (a = 3 and b = 4) 
   or (a = 5 and b = 6) 
   or (a = 9 and b = 10);

优化后:

select a,b from test where (a,b) in ((1,2),(3,4),(5,6),(9,10));

 

posted @ 2021-01-15 13:56  一个人的孤独自白  阅读(3367)  评论(0编辑  收藏  举报