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 cy.id < 155 GROUP BY t.crimeyearid, cy.title_short ORDER BY t.crimeyear' at line 23

SELECT t.crimeyearid, cy.title_short AS yeartitle ,asb_total ,bur_total ,rob_total ,veh_total ,vio_total ,shop_total ,(other_total + shop_total + drug_total + cda_total + pdw_total + othertheft_total + weap_total + bike_total + pers_total + ord_total) as other_total ,drug_total ,cda_total ,pdw_total ,othertheft_total ,other_total as misc_total ,bike_total ,weap_total ,pers_total ,ord_total ,all_total FROM total_dis t INNER JOIN crimeyear cy ON (cy.ID = t.crimeyearid) WHERE t.dis= and cy.id < 155 GROUP BY t.crimeyearid, cy.title_short ORDER BY t.crimeyearid