在GROUP BY中选择TOP 3 [英] SELECT TOP 3 Within a GROUP BY

查看:220
本文介绍了在GROUP BY中选择TOP 3的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

以下是我选择前三名获奖者的报告:

Here is what I have for a report that selects the top 3 winners:

展开 | 选择 | Wrap | 行号

推荐答案

我认为问题在于子查询中的WHERE子句。我不认为别名''Dupe'应该出现在那里,而是那个'过滤掉你的取消资格和最好的记录的地方。


所以那可能是这样的吗?

I think the problem lies in the WHERE clause in the sub-query. I don''t think the alias ''Dupe'' should appear in there, and rather that''s the spot to filter out your disqualifications and best of records.

So with that said, maybe something like this?

展开 | 选择 | Wrap | 行号


实际上,他们需要别名,因为子查询是从父查询中过滤类。
Actually, they will need the alias because the subquery is filtering on class from the parent query.


啊,对......这是一个相关的子查询!那么这可能会改变我的建议吗?
Ah, right...it''s a correlated sub-query! So this may change my advice?


这篇关于在GROUP BY中选择TOP 3的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆