I have 2 tables in my database. One is for orders, and one is for companies.
Orders has this structure:
OrderID | attachedCompanyIDs -------
attachedCompanyIDs is one big string, so mysql try to find company in this its cast to integer
when you use where in
so if comapnyid = 1 :
companyID IN ('1,2,3')
this is return true
but if the number 1 is not in the first place
companyID IN ('2,3,1')
its return false