选择唯一值 [英] select unique values

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

问题描述

亲爱的研究员,

我想从表格的字段中提取唯一值。这是表中重复的值不会在查询结果中重复。


Thx。

解决方案

你需要决定什么您需要的唯一性级别。

在查询的设计视图中,选择查询属性。

其中两个属性是''Unique Values''& ''Unique Records'' - 决定你需要哪一个。并选择一个。

在SQL中,你在SELECT单词之后添加一个谓词''DISTINCT''或''DISTINCTROW'。 / blockquote>

解释在这里



在我的桌子上添加了很多动物猫,狗,牛,猫,猫,羊,牛,羊等


这些动物以身份证方式重复。


我想看看那里有什么动物表。

即返回我只有动物的物品



猫,狗,牛,猫,猫,羊,牛,羊的结果这个数据应该是


猫,狗,牛,羊


thx


类似


SELECT AnimalID

FROM TableName

GROUP BY AnimalID;





SELECT DISTINCT AnimalID

来自TableName;


要么应该工作。



解释在这里



在我的桌子上添加了很多动物猫,狗,牛,猫,猫,羊,牛,羊等


这些动物以ID方式重复。


我想看看桌子上有什么动物。

即返回我的动物只有这些数据的猫,狗,牛,猫,猫,羊,牛,羊的b $ b结果应该是


猫,狗,牛,羊


thx


Dear Fellows,
I want to extract unique values from a table''s field. That is values which repeated in table does not repeat in query result.

Thx.

解决方案

You need to decide what level of uniqueness you require.
In design view of the query, select query properties.
Two of the properties are ''Unique Values'' & ''Unique Records'' - decide which one you need and select just one.
In SQL you add one of the predicates ''DISTINCT'' or ''DISTINCTROW'' after the word SELECT.


Explaination is here



In my table a lot of animals are addedd Cat, dog, cow, cat, cat,sheep, cow, sheep, etc

Thses animals are repeated in ID fashion.

I want to see what animals are there in table.
i.e. return me animal only ones


result of Cat, dog, cow, cat, cat,sheep, cow, sheep of this data should be

cat,dog,cow,sheep


thx


Something like

SELECT AnimalID
FROM TableName
GROUP BY AnimalID;

Or

SELECT DISTINCT AnimalID
FROM TableName;

Either should work.


Explaination is here



In my table a lot of animals are addedd Cat, dog, cow, cat, cat,sheep, cow, sheep, etc

Thses animals are repeated in ID fashion.

I want to see what animals are there in table.
i.e. return me animal only ones


result of Cat, dog, cow, cat, cat,sheep, cow, sheep of this data should be

cat,dog,cow,sheep


thx


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

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