Access 2010查询重复项 [英] Access 2010 query duplicates
问题描述
你好,
我有以下问题:
table1
id / ArticleCode / ArticleColor
1/123 /蓝色
/ 123 /蓝色
3/222 /绿色
4/333 /红色
5/444 / blue
在这些数据中我需要选择唯一值来返回:
1/123 /蓝色
3/222 /绿色
4/333 /红色
5/444 /蓝色
所以基本上,我需要保留所有字段,但只丢弃具有重复ArticleCode的记录
当我运行向导查找重复项并包含ID时和ArticleColor,它返回所有recods。
当我使用COUNT([ArticleCode])= 1时,它只返回没有副本的记录。
请帮帮我
Hello,
I have following problem:
table1
id / ArticleCode / ArticleColor
1 / 123 / blue
2 / 123 / blue
3 / 222 / green
4 / 333 / red
5 / 444 / blue
Out of this data I need to pick unique values to return:
1 / 123 / blue
3 / 222 / green
4 / 333 / red
5 / 444 / blue
so basically, i need to keep all the fields, but throw out only records that have duplicate ArticleCode
When I run a wizard to find duplicates, and include ID and ArticleColor, it returns all recods.
When I use COUNT([ArticleCode])=1 it returns only record w/o duplicates.
Please help me out
推荐答案
你需要一个SELECT DISTINCT查询。
You need a SELECT DISTINCT query.
尊重Seth,那将不工作,也不会DISTINCTROW因为字段[ID]包含唯一值。你真的应该在测试数据库中尝试它,不要接受我的话...... ;-)
现在,如果OP不需要[ID]那么你可以在查询中仅包括[ArticleCode]和[ArticleColor],使用DISTINCT和DISTINCT中的任何一个。谓词。
Respectfully Seth, That will not work, nor will "DISTINCTROW" in that the field [ID] contains a unique value. You really should try it in a test database, don''t take my word for it... ;-)
Now, if OP does not need [ID] then you can include only the [ArticleCode] and [ArticleColor] in the query use either of the "DISTINCT" Predicates.
感谢您的回复,
Thanks for reply,
这篇关于Access 2010查询重复项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!