问题描述
我有一个查询,我在哪里使用GROUP_CONCAT
和自定义分隔符,因为我的结果可能包含逗号:"----"
I have a query where I am using GROUP_CONCAT
and a custom separator as my results may contain commas: '----'
这一切都很好,但是仍然用逗号分隔,所以我的输出是:
This all works well, however it is still comma separated, so my output is:
Result A----,Result B----,Result C----
如何做到这一点,输出是:
How can I make it so the output is:
Result A----Result B----Result C----
我认为这是自定义分隔符的想法!
I thought this was the idea of a custom separator!
如果不这样做,您可以在结果中转义逗号,这样我就可以在PHP中以GROUP_CONCAT
逗号爆炸?
Failing that, can you escape commas in your results, so I can explode in PHP by the GROUP_CONCAT
commas?
推荐答案
好像您在 GROUP_CONCAT 函数.
GROUP_CONCAT(artists.artistname SEPARATOR '----')
编写方式是使用默认的逗号分隔符将artists.artistname
与'----'
字符串连接.
The way you've written it, you're concatenating artists.artistname
with the '----'
string using the default comma separator.
这篇关于GROUP_CONCAT逗号分隔符-MySQL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!