我的sql数据库中有3列
Cateogory Subcategory 1 Subcategory 2
---------- ------------- -------------
Operations others production
Operations others production
SupplyChain others sales
SupplyChain others sales
Operations others distribution
Operations others production
SupplyChain external sales
我可以有相同的类别,但子类别1和2的值不同。
我需要编写一个包含子类别1和子类别2的唯一类别列表的查询。
我怎样才能做到这一点?
示例输出
Cateogory Subcategory 1 Subcategory 2
Operations others production
SupplyChain others sales
Operations others distribution
答案 0 :(得分:0)
使用DISTINCT
关键字
SELECT DISTINCT Cateogory, Subcategory 1, Subcategory 2
FROM your_table