1

如何对 3 列使用 group by 它显示它不是 group by 表达式的错误。这是查询。

select
   brewer.name as brewer,beer.name as beer,count(ratings.score) as LowestRating
from ratings,beer,brewer
where ratings.beer=beer.id and beer.brewer=brewer.id
group by brewer,beer; 
4

1 回答 1

1

您应该GROUP BY按列,而不是整个表:

select
     brewer.name as brewer,
     beer.name as beer,
     count(ratings.score) as LowestRating
  from
    ratings,
    beer,
    brewer
where
  ratings.beer = beer.id
  and beer.brewer = brewer.id
group by brewer.name, beer.name; 
于 2013-11-06T21:59:25.753 回答