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 'AND cg_carnum = 242 AND cg_status = 2 ORDER by cg_rank DESC, cg_chassis DESC, cg' at line 1