我很好奇是否可以选择多个完整 id 的 JOIN 作为一个字段...类似于
table foo
1 | a
2 | b
3 | c
然后是伪代码:
select CONCAT_AS_STRING( (select id from foo), ","); //the "," would be the token that it would JOIN on
所以结果是 “1,2,3”
MySQL有这样的功能吗?
最佳答案
尝试 GROUP_CONCAT:
从 foo 中选择 GROUP_CONCAT(id SEPARATOR ',');
关于mysql - 是否可以选择一个 int 作为 JOINed 字符串连接?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8873811/