MySQL SELECT DISTINCT multiple columns

后端 未结 6 1401
误落风尘
误落风尘 2020-11-27 05:28

Let\'s say I have columns a, b c, d in a table in a MySQL database. What I\'m trying to do is to select the distinct values of ALL of these 4 columns in my tabl

6条回答
  •  谎友^
    谎友^ (楼主)
    2020-11-27 05:57

    can this help?

    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
    

提交回复
热议问题