我有两个文件:帖子和用户。我需要按帖子获得前10名用户,在SQL中应该是:
SELECT us.name, COUNT(po.id) AS NumberOfPost FROM User us INNER JOIN Post po on
po.userId = us.id GROUP BY us.name ORDER BY NumberOfPost DESC;只有一份工作就有可能做到这一点?不需要一份工作去加入,一份工作去做前十名?我必须遵循mapreduce模式的“十大”,但我不需要遵循任何连接模式在这种情况下。只有一份工作才能做到这一点?
发布于 2015-03-20 09:23:25
最好在蜂巢中实现这一点。执行下面提到的查询来执行前10位
SELECT us.name, COUNT(po.id) AS NumberOfPost FROM User us INNER JOIN Post po on po.userId = us.id GROUP BY us.name ORDER BY NumberOfPost DESC Limit 10;https://stackoverflow.com/questions/29114546
复制相似问题