假设我a, b c, d在MySQL数据库的表中有列。我想要做的是选择表中所有这4列的所有唯一值(仅唯一值)。我尝试了类似的东西:
a, b c, d
SELECT DISTINCT a,b,c,d FROM my_table; SELECT DISTINCT a,b,c,d FROM my_table GROUP BY a,b,c,d;
这些都不起作用。有人可以帮忙吗?
谢谢
注意 我想要分别显示各列的不同值a, b, c d。不是价值的独特组合
a, b, c d
能帮上忙吗?
select (SELECT group_concat(DISTINCT a) FROM my_table) as a, (SELECT group_concat(DISTINCT b) FROM my_table) as b, (SELECT group_concat(DISTINCT c) FROM my_table) as c, (SELECT group_concat(DISTINCT d) FROM my_table) as d