多个不区分 [英] Multiple NOT distinct
本文介绍了多个不区分的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个MS Access数据库,我需要创建一个SQL查询,该查询允许我在一个列中选择所有不重复的条目,同时仍保留所有值.
I've got an MS access database and I would need to create an SQL query that allows me to select all the not distinct entries in one column while still keeping all the values.
在这种情况下,一个例子比以往任何时候都有价值数千个单词:
In this case more than ever an example is worth thousands of words:
表格:
A B C
1 x q
2 y w
3 y e
4 z r
5 z t
6 z y
SQL魔术
结果:
B C
y w
y e
z r
z t
z y
基本上,它删除了列B的所有唯一值,但保留了 数据保存.我可以先按b分组",然后再计数> 1"以得到不明显的字符,但是结果将只列出B的一行,而不是我需要的2或更多行.
Basically it removes all unique values of column B but keeps the multiple rows of the data kept. I can "group by b" and then "count>1" to get the not distinct but the result will only list one row of B not the 2 or more that I need.
有帮助吗?
谢谢.
推荐答案
Select B, C
From Table
Where B In
(Select B From Table
Group By B
Having Count(*) > 1)
这篇关于多个不区分的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文