我收集了Cost记录,希望选择特定的成本并按天对其进行分组 @costs = Cost.where(source:(params[:source]),month:params[:month]: ERROR: column "costs.id" must appear in the GROUP BY clause or be used in an aggregate function
我的目标是获取特定的记录并按天分组例
我已经看过如何在TOS中使用tMap来映射类似SQL的联接中的不同字段。如何根据特定字段进行聚合?如果我有两张桌子:and that are tMap'ped to [ B, C, F, G ]如何将结果聚合到非唯一B的多个条目中,我可以看到如下所示:
[ B, count(B), avg(C), avg(F),