Informix - 将值列表聚合为逗号分隔的字符串
Informix 中有没有办法将值列表转换为逗号分隔的字符串?例如,我有以下查询作为子选择:
SELECT [State] From States
我想将该选择中的所有值转换为逗号分隔的列表。
我可以在 informix 中这样做吗?
Is there a way to convert a list of values into a comma-delimited string in Informix? For example, I have the following query as a subselect:
SELECT [State] From States
I would like to convert all the values from that select into a comma-separated list.
Can I do that in informix?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我认为您需要的答案在这些问题中给出: SO 715350,SO 489081。它展示了如何创建和使用 GROUP_CONCAT() 聚合来完全满足您的需求。否则该功能不可用 - 也就是说,您必须将其添加到 Informix,但它可以(相当)轻松地添加。
I think the answer you need is given in these questions: SO 715350, SO 489081. It shows how to create and use a GROUP_CONCAT() aggregate that will do exactly what you want. The functionality is otherwise not available - that is, you have to add it to Informix, but it can (fairly) easily be added.
您始终可以使用递归 SQL
:
You can always use recursive SQL:
Producing: