我很好奇是否有可能选择,因为一个字段是几个整数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有这样的功能吗?
答案 0 :(得分:3)
尝试GROUP_CONCAT:
SELECT GROUP_CONCAT(id SEPARATOR',')FROM foo;