Tags Informix-基于id连接包含在同一列中的数据
我需要根据Informix中的id将同一字段中的字符串连接起来。我意识到这可以在MSSQL中轻松完成 以下是我当前表格的一个示例:Tags Informix-基于id连接包含在同一列中的数据,tags,concatenation,informix,Tags,Concatenation,Informix,我需要根据Informix中的id将同一字段中的字符串连接起来。我意识到这可以在MSSQL中轻松完成 以下是我当前表格的一个示例: id | doc_num | page_num | description ------------------------------------------------- 1 | 1 | 1 | This is the story about 1 | 1 | 2 | a girl named Daisy.
id | doc_num | page_num | description
-------------------------------------------------
1 | 1 | 1 | This is the story about
1 | 1 | 2 | a girl named Daisy.
1 | 2 | 1 | Daisy had a dog named
1 | 2 | 2 | Rover.
2 | 1 | 1 | This story is about Bob.
2 | 2 | 1 | Bob is a DBA who works
2 | 2 | 2 | at an important company
2 | 2 | 3 | that develops important
2 | 2 | 4 | software.
期望输出:
id | description
------------------------------------------------------------
1 | This is a story about a girl named Daisy.
| Daisy has a dog named Rover.
------------------------------------------------------------
2 | This story is about Bob. Bob is a DB who works at an
| important company that develops important software.
------------------------------------------------------------
我在这里找到了答案:
因为我正在运行Informix 12,所以它使用rank()over()sys_connect_by_path()。欢迎使用堆栈溢出,并且通过研究DBA堆栈交换解决了您的问题。如果“可以在MS SQL中轻松实现”来展示您在那里的实现方式,这将是明智的——它也可能会引导人们向您建议在Informix中实现这一点的正确方法。此外,提及版本号和平台对任何DBMS都有帮助。(例如,对于Informix,至少说“Windows上的Informix 12.10”。有时,它需要更具体;最好说“Informix 12.10.FC9”。)通常,添加标记会得到更好/更快的帮助。