我需要在Informix中基于id连接相同字段中的字符串。我意识到这可以在MSSQL中轻松完成。
以下是我当前表格的一个示例:
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.
------------------------------------------------------------
答案 0 :(得分:1)
我在这里找到了答案: https://dba.stackexchange.com/questions/65101/multiple-table-rows-in-one-row-informix
由于我正在运行Informix 12,它使用rank()over()sys_connect_by_path()。