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

A表 B字段值有 1 2 3 4 5 6 4 6 3 4 1 怎么样通过语句查询显示只有 1 2 3 4 5 6
2025-03-22 12:18:39
推荐回答(4个)
回答1:

一、用distinct 关键字 去掉重复的数据
select distinct B from A oder by B
显示的结果就是 123456

二、 用group by 关键字 对B字段进行分组
select B from A group by B

回答2:

select distinct A.B from A

回答3:

select b from a
group by b

回答4:

select distinct B from A order by B