使用group by分组查询全部字段时报错
SELECT * FROM t_pc_rights_acquire GROUP BY product_id;
解决方法:
select查询的字段必须是group by后面的字段product_id,使用聚合函数max/min/avg/count等包裹字段使用。
如以下sql都能正常查询:
SELECT product_id FROM t_pc_rights_acquire GROUP BY product_id;
SELECT count(id), product_id FROM t_pc_rights_acquire GROUP BY product_id;
SELECT count(id),max(id), product_id FROM t_pc_rights_acquire GROUP BY product_id;