在 rails 中怎么实现 sql 语句 SELECT test.result,count(test.result) FROM testWHERE id=100 GROUP BY test.result
https://ruby-china.github.io/rails-guides/active_record_querying.html#count
试试这个
Test .select( :result, 'COUNT(result) AS results_count' ) .where(id: 100) .group(:result)
Test.where(id: 100).group(:result).count
这个计数明显不对吧