DISTINCT没有按预期工作 [英] DISTINCT not working as expected

查看:82
本文介绍了DISTINCT没有按预期工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好。我有一个查询需要拉出在特定月/年中有一个分数的所有位置(此组合将每月更改)。 (有些地方有多个分数。)我认为DISTINCT可以做到,但结果与没有DISTINCT的情况相同。我希望有人可以提供帮助。在此先感谢。

Hi. I have a query that needs to pull all locations that have one score in a specific month/year (this combo will change monthly). (Some locations have multiple scores.) I thought a DISTINCT would do it but the results are the same as without the DISTINCT. I hope someone can assist. Thanks in advance.

展开 | 选择 | Wrap | 行号

推荐答案

你说你认为DISTINCT会做它" ;.但你还没有说出什么是它。是。样本数据和结果有助于理解it的含义。


但这是DISTINCT的作用,查看返回行集中的每个值组合,如果存在重复,则只返回一行,其中每一列的值在一行中与另一行相同。


给定此数据集
You said you thought DISTINCT would do "it". But you haven''t said what "it" is. Sample data and results would be helpful to understand what you mean by "it".

But here''s what DISTINCT does, look at every combination of values in the returned row set, only return one row if there is duplication where every column value is the same in one row compared to another row.

Given this dataset
展开 < span class =codeDivider> | 选择 | Wrap | Line数字


展开 | 选择 | Wrap | 行号


上面是我想看到的,而不是练习ID 4024 6次。希望澄清。
The above is what I want to see, not practice ID 4024 6 times. Hope that clarifies.


这篇关于DISTINCT没有按预期工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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