GROUP_CONCAT逗号分隔符-MySQL [英] GROUP_CONCAT comma separator - MySQL

查看:1059
本文介绍了GROUP_CONCAT逗号分隔符-MySQL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个查询,我在哪里使用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?

推荐答案

好像您在编写方式是使用默认的逗号分隔符将artists.artistname'----'字符串连接.

The way you've written it, you're concatenating artists.artistname with the '----' string using the default comma separator.

这篇关于GROUP_CONCAT逗号分隔符-MySQL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆