SELECT c.id, c.name, SUM(ABS(v.vote)) AS scoreFROM categories c,items i, votes v WHERe c.id = i.category_id AND i.id = v.voteable_id AND v.created_at > '#{1.week.ago}'GROUP BY c.id, c.nameORDER BY score DESC LIMIT 8;
“不允许在SELECT子句中包括GROUP BY子句中未引用的列名。”
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)