【问题标题】:MySQL combine multiple columns data to 1 column [duplicate]MySQL将多列数据合并为1列[重复]
【发布时间】:2019-01-07 23:24:03
【问题描述】:

我想将多列数据合并为一列。

例如:

这是我的表结构:

[Color], [Size] , [Other]
White  , 23"x22", something
Black  , 22"x44", test

这就是我想要实现的目标:

[Other_Attributes]
color=White,size=23"x22",other=something
color=Black,size=22"x44",other=test

如何使用 MYSQL 实现这一目标

【问题讨论】:

    标签: mysql multiple-columns


    【解决方案1】:

    这样的事情会有所帮助

    select CONCAT('color=',Color,',size=', Size, ',other=', Other) concat_col 
    From Tbl
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-02-03
      • 1970-01-01
      • 2016-09-22
      • 2017-03-25
      • 2016-04-04
      • 1970-01-01
      • 2018-03-11
      • 1970-01-01
      相关资源
      最近更新 更多