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 'GROUP BY rel_prods_cats2.id_categoria, tbl_prods.id_producto, tbl_prods.nombre, ' at line 1