Query: Select avg(rw_overall) as rw_overall, avg(rw_technical) as rw_technical, avg(rw_features) as rw_features, avg(rw_price) as rw_price, avg(rw_reliability) as rw_reliability, max(rw_id) as rw_id From reviews Where p_id= And main_cat_id=1 Group by p_id
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 main_cat_id=1 Group by p_id' at line 9