【问题标题】:Concat MySQL Query连接 MySQL 查询
【发布时间】:2014-07-30 12:35:02
【问题描述】:

这是我的桌子:

item     groupID
-----------------------
foo      10
foo      11
foo      12
bar      1
bar      3

我需要运行一个查询,结果如下:

item     groupIDs
-----------------------
foo      10,11,12
bar      1,3

有什么想法吗? 谢谢

【问题讨论】:

标签: mysqli concat


【解决方案1】:

好吧,我同时发现了:)

select item,group_concat(groupIDs) from mytable group by item

【讨论】:

    猜你喜欢
    • 2021-08-16
    • 1970-01-01
    • 1970-01-01
    • 2012-04-21
    • 2016-05-19
    • 2011-11-25
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多