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 'all from accountable_jobs where isstaging = 0 order by case when city = '' ...' at line 1:select * all from accountable_jobs where isstaging = 0 order by case when city = '' then 0 else 1 end, FIELD(zipcode, '') DESC, dateadded limit 0, 25