Can Rails' Active Record handle SQL aggregate queries?

前端 未结 3 1297
孤独总比滥情好
孤独总比滥情好 2021-02-02 02:33

Just started learning active record and am wondering how to best retrieve data from multiple tables where an SQL aggregate query is involved.

In the following example (f

3条回答
  •  梦如初夏
    2021-02-02 03:24

    An include is just a clever left join, you can use that in conjuction with select and group_by in your .find

提交回复
热议问题