Is there something wrong querying like this:
select * from category_cross_selling
where 'SOMEID' in (f_categories_from, f_categories_to);
instead of like this?:
select * from category_cross_selling
where f_categories_from = 'SOMEID' or f_categories_to = 'SOMEID';
I do this sometimes, but I don't know if it is bad practice or if I break the optimizer engine of MySQL or I don't know, but people have told me to stop doing it.
I like it because it is clear that it is the same id that I am looking for in any columns, and you don't duplicate constants, thus avoiding bugs.
EDIT:
Notice that the reason I asked this question is because normally in IN
searches, you put the column in the left side and N constants in the right side