Tim*_*Tim 6 postgresql ruby-on-rails ruby-on-rails-3
我有一个Rails 3应用程序,保持高分.我在Heroku上托管它,它使用postgresql作为数据库.
我需要从分数表中提取最高分.该表有列score和user_id.它在mysql中使用以下代码:
Score.order('score DESC').group('user_id').limit(25)
这会对每个用户的最高分进行排名.
当我把应用程序放在Heroku上时,我得到以下psql错误 PGError: ERROR: column "scores.id" must appear in the GROUP BY clause or be used in an aggregate function
我已经读过,但没有找到明确的答案.重新创建上述查询以使用PostgreSQL的最佳方法是什么?
谢谢!
蒂姆
| 归档时间: |
|
| 查看次数: |
1338 次 |
| 最近记录: |