我网上看到说,需要select 的字段,都得跟到group by 子句中,但是我在postgresql中试了以下两条命令,都没出错耶
select add_time, hope_price from bargain group by id;
select buy.id, title, count("buy_id") from buy left join buy_have as t1 on t1.buy_id = buy.id group by buy.id;
id是数据库的primary key
貌似 MySQL 也不需要跟,但是查出来的是哪一个并不能确定,除非你所有记录的那个字段都是一样的就不存在这个问题。