SQL数据库中一个表里的某一字段值有6种 如何通过语句查询这6种字段值都是什么???急急急急急

A表 B字段值有 1 2 3 4 5 6 4 6 3 4 1 怎么样通过语句查询显示只有 1 2 3 4 5 6

第1个回答  2012-01-06
一、用distinct 关键字 去掉重复的数据
select distinct B from A oder by B
显示的结果就是 123456

二、 用group by 关键字 对B字段进行分组
select B from A group by B本回答被提问者采纳
第2个回答  2011-12-21
select distinct A.B from A追问

A是表 B是A表中的字段

追答

select B from A group by B
这样试试
应该两种都可以吧

本回答被网友采纳
第3个回答  2011-12-21
select b from a
group by b
第4个回答  2011-12-21
select distinct B from A order by B
相似回答