You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 's Blade' AND desativado = '' ORDER BY (CASE WHEN estoque > 0 THEN 0 ELSE 1 END),' at line 1