Efficient MySQL Query Method to avoid multiple OR statement -
i quite new queries , know if there easier solution query working on.
for instance want data x 5,7,9,11,13,15 , 17.
i have query below;
select * abc x = 5 or x = 7 or x = 9 or x = 11 or x = 13 or x = 15 or x = 17;
is okay use query or there other simpler , efficient solution?
edit
does affect perfomance when use x=[5,7,8,11,13,15,17] vs x=[5,11,7,15,8,17,13]
x id of category instance.
this shorter performs equally
select * abc x in (5,7,9,11,13,15,17)
but remember if 1 entry in in
clause null
returns false.
Comments
Post a Comment