You can translate the question and the replies:

Combining values of two rows into one row

Hello. I have a Denodo integration view with 2 columns: | person_id_column | pet_column | | -------- | -------- | | 0 | Cat | | 1 | Dog | | 1 | Cat | | 2 | Dog | | 2 | Rabit | | 3 | Cat | | 3 | Fish | | 4 | Squirrel | | 5 | Dog | | 6 | Cat | | 6 | Fish | My goal is to convert this view into a view like this one: | person_id_column | pet_column | | -------- | -------- | | 0 | Cat | | 1 | Dog ; Cat | | 2 | Dog ; Rabit | | 3 | Cat ; Fish | | 4 | Squirrel | | 5 | Dog | | 6 | Cat ; Fish | Can I do this in Denodo? If so, how, please? Thank you for any help you can provide!
user
05-07-2023 18:03:11 -0400
code

4 Answers

Hi, Yes, you can use the [GROUP_CONCAT](https://community.denodo.com/docs/html/browse/8.0/en/vdp/vql/functions/aggregation_functions/aggregation_functions#group-concat) aggregation function. In a selection view you only have to group by your *"person_id_column"* and create a new field containing the function. e.g. ``` GROUP_CONCAT('; ', <field_name>) ``` Hope this helps
Denodo Team
06-07-2023 04:18:17 -0400
code
Hello. Thank you very much for this information. In my view I created a new column that I named "pets_column". I then tried to enter in the Field expression box the following code: GROUP_CONCAT('; ', <view_name>.pet_column) But I am getting a red "x" indicating that the code is not correct and which does not allow me to click on the "Ok" button. Am I missing something? Do I need to have installed a special package to be able to use the GROUP_CONCAT function? Thank you again for all your help!
user
06-07-2023 10:46:10 -0400
It should work without any extra since it's a built-in function. Try creating a new selection view and add the group by, the aggregation field from scratch, sometimes it can happen that the vql validator shows unexisting errors. It should not happen with VDP Administration Tool. Hope this helps
Denodo Team
06-07-2023 11:08:56 -0400
code
Hello. I created a new view from scratch. It worked. Thank you again for all your help!
user
06-07-2023 14:27:34 -0400
You must sign in to add an answer. If you do not have an account, you can register here