SELECT brands.*,location_country_new.name,comp2brand.c2b_id,comp2brand_official.c2bo_id,CEIL(c2b_id/10) AS c2b_flag, CEIL(c2bo_id/10) AS c2bo_flag FROM brands LEFT JOIN location_country_new ON id_country = b_country_id LEFT JOIN comp2brand ON b_id = c2b_brand_id LEFT JOIN comp2brand_official ON b_id = c2bo_brand_id WHERE b_checked = '1' AND b_name LIKE 'R%' GROUP BY b_id ORDER BY c2bo_flag DESC, c2b_flag DESC, b_name ASC LIMIT -64,32
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 '-64,32' at line 18