How to concatenate all the rows linked with a same id into one row?
Hi,
Please check below example, I created for you.
Hello Ernesto,
Could you give us more details of your demand?
Maybe this function can help you:
Regards.
Sorry but you need detail more your question...
What kinda of rows, DB, excel?
into on row?
I really like to help but need more information
As you tagged the "SQL" & "Aggregate" in question, so I am assuming you are asking for the database result from aggregate or SQL.
So basically your case is for one to many relationship. There may be multiple rows connected with one Id and in data base query you want that all rows should be there in one column separated by some delimiter. For this you need to use SQL query with STUFF() keyword to get the multiple rows in a single row.
https://www.mytecbits.com/microsoft/sql-server/concatenate-multiple-rows-into-single-string
if this is not the case then please let us know exact use case of the issue.
regards
I tried those solutions but did not work in Outsystems
Please see the pic I want to combine multiple rows of values with the same ID in SQL or aggregates , to produce a table.
As I already answered you need to use SQL query with STUFF keyword here and it works in OutSystems perfectly. I have done this many times. if facing issue then please share OML.
SELECT {LogisticBlockFreshWarehouse}.[LogisticBlockFreshId],STUFF((SELECT CONCAT(', ', {LogisticBlockFreshWarehouse}.[WarehouseId]) FROM {LogisticBlockFreshWarehouse} i WHERE i.[LogisticBlockFreshId] = o.[LogisticBlockFreshId] FOR XML PATH ('')),1,1,'') AS {LogisticBlockFreshWarehouse}.[WarehouseId]) FROM {LogisticBlockFreshWarehouse} o GROUP BY {LogisticBlockFreshWarehouse}.[LogisticBlockFreshId]
Thank you for providing that information quickly. When I remove the comma it is working but if I keep the comma I got this error.
I added
CAST ( pp.[WarehouseId] AS VARCHAR(255) it is working. Thank you