SQL concatenate rows query

前端 未结 3 556
礼貌的吻别
礼貌的吻别 2021-01-15 12:53

Say we have a table

table posts
+---------+-----------+--------------------------------+
| postId  | title     | status    | bodyText           |
+--------         


        
3条回答
  •  时光说笑
    2021-01-15 13:18

    If you use MySQL then you can use GROUP_CONCAT:

    SELECT status, GROUP_CONCAT(title)
    FROM posts
    GROUP BY status
    

提交回复
热议问题