SELECT m.*, count(b.id) AS b_count, (IF(LOCATE('завод',m.firm_name)>0,1.5,0)) AS firm_relevance FROM main m LEFT OUTER JOIN firms_bl b ON m.id=b.firm_id WHERE (m.firm_name LIKE '%завод%') GROUP BY m.id ORDER BY firm_relevance DESC,firm_name ASC LIMIT 20
Illegal mix of collations (cp1251_general_ci,IMPLICIT) and (utf8_general_ci,COERCIBLE) for operation 'locate'/home/s/statexper2/nomertelefona.ru/public_html/system/kernel.php 440