You can translate the question and the replies:

concatenate rows - same column

Hello, I am trying to concatenate data from the same column but on different rows for the same record. The column in question is one that contains notes and what I need to do is combine notes. Below is an example of what I am looking to do. **TABLE** **ID SEQ NO 1 SEQ NO 2 NOTES** 123 3 1 Customer said Hi 123 3 0 I said Hello 123 2 0 no one home 456 3 1 Customer Happy 456 3 2 Survey Completed 456 3 0 Call Started I need to combine the** notes** column for the same **ID** and **Seq No 1**, and order by** Seq No 2**. Essentailly I need to combin the notes section from multiple rows to one row. Below is what I need the output to look like. **FINAL TABLE** **ID NOTES** 123 I said Hello, Customer said Hi 123 No one home 456 Call Started, Customer Happy, Survey Completed Any assistance you can provide would be greatly appreciated. Thanks
user
21-12-2018 13:18:27 -0500
code

6 Answers

Hi, I was successfully able to achieve your results by transforming the row values into columns and then concatenating these column values. To do that you could refer the knowledge base article [How to Pivot and Unpivot views](https://community.denodo.com/kb/view/document/How%20to%20Pivot%20and%20Unpivot%20views?category=Combining+Data) and [CONCAT](https://community.denodo.com/docs/html/browse/7.0/vdp/vql/appendix/syntax_of_condition_functions/text_processing_functions#concat) section for more information. Hope this helps!
Denodo Team
24-12-2018 06:53:44 -0500
code
Hello, The sections you directed to me do not help resolve my issue. I need to combine values in the same column but on different rows into a new column that has both values in the row. Example: *Before* **Row Number** **Person Column ** **Column XYZ** 1 Ryan Value 1 2 Ryan Value 2 *After* **Row Number** **Person Column ** **Column XYZ** 1 Ryan Value 1, Value 2 Any assistance you can provide would be greatly appreciated. Thank you.
user
02-01-2019 11:44:01 -0500
Hello, I was able to achieve the outcome I desired above. However the issue I am running into now is that the text in the field is so long that when I export it in excel all of the text in the field does not stay in the field in the spreadsheet. There are so many characters in the field that the values spread into multiple columns. Is there a way to wrap the text so that it stays in the column regardless of the length? Thank you
user
08-01-2019 15:14:55 -0500
Hi, A column name can have a maximum length of characters as 100. When I exported it into an excel and clicked on the column name cell, I could see that the text gets wrapped into that cell. Hope this helps!
Denodo Team
04-04-2019 02:03:20 -0400
code
How did you achive this? can u please explain? I tried pivot, doesn't help.
user
05-11-2020 09:12:47 -0500
Hi, I was able to merge data from the same column but on different rows by using the group_concat function with subqueries in the Virtual DataPort. For example, if I have a table containing the id,seqno1, seqno2, and notes field and I need to get the final result based on the id,seqno1, seqno2 by merging the notes field. For that, I would use a similar query as below, > select id, group_concat(',',notes) from (select * from bv_table order by id, seqno1, seqno2) group by id,seqno1 For more information, you could refer to the [GROUP_CONCAT](https://community.denodo.com/docs/html/browse/latest/vdp/vql/appendix/syntax_of_condition_functions/aggregation_functions#group-concat) section of the Virtual DataPort VQL Guide. Hope this helps!
Denodo Team
18-11-2020 00:38:46 -0500
code
You must sign in to add an answer. If you do not have an account, you can register here