You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ') ORDER BY get_estate_relevance(id,1) DESC' at line 1540SELECT id FROM estate WHERE status = 1 AND archive = 0 AND id IN () ORDER BY get_estate_relevance(id,1) DESC