mysql 的group_concat函数很好用,可以把列转成行。
SELECT threadid, group_concat(postid separator ',') as postids FROM msg_reply where group by threadid
完整的语法如下
group_concat([DISTINCT] 要连接的字段 [Order BY ASC/DESC 排序字段] [Separator '分隔符'])
https://www.csdn.net/gather_29/MtTaIgxsNTc2OC1ibG9n.html


显示列的注释

网友评论