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 '= 1 AND p.client_flag = 2 ,p.large_plus, p.large) AS large,IF(b.MAP = 1,1, .90) ' at line 1