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 ppi.price > 0 AND is_competitor_product=0 and pi_status=1 ORDER BY pi.reta' at line 6