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 '2 AND product_category_agent = 'true' GROUP BY product_category_id ORDER BY prod' at line 3SELECT * FROM tbl_product INNER JOIN tbl_product_category ON ( tbl_product.product_product_category_id = tbl_product_category.product_category_id ) WHERE product_category_product_sub_category_id = 15 AND product_category_status = 'active' AND product_status = 'active'2 AND product_category_agent = 'true' GROUP BY product_category_id ORDER BY product_category_order ASC