gpt4 book ai didi

mysql - 如何在 MySql 的 SQL 查询中将行折叠成逗号分隔的列表

转载 作者:行者123 更新时间:2023-11-29 01:33:24 25 4
gpt4 key购买 nike

在 T-SQL 中将相关值连接到 SQL 查询中的逗号分隔字符串中相对简单(参见此处:What is the best way to collapse the rows of a SELECT into a string? 和此处:What is the best way to collapse the rows of a SELECT into a string?)。后一个链接准确地描述了我需要做什么,但我需要在 MySql 中完成,而在 T-SQL 中有效的查询在 MySql 中不起作用。那里的任何 MySql 专家都知道如何做到这一点?

谢谢!

最佳答案

称为group_concat

select group_concat(your_id) from your_table

关于mysql - 如何在 MySql 的 SQL 查询中将行折叠成逗号分隔的列表,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4475804/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com