Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Combining data from different rows to a string

I am getting data from a single column in a datatable. I need it to be combine to a string separated by comma or any delimiter.

The end result should be a string instead of the tabular data.

let words = datatable(word:string, code:string) [
"apple","A",
"orange","B",
"grapes","C"
];
words | project word;

I need to combine the result combined into a string with a delimiter.

Result should be : "apple,orange,grapes"

like image 518
Dona Avatar asked Aug 28 '26 17:08

Dona


1 Answers

try combining strcat_array() with summarize make_list() as follows:

let words = datatable(word:string, code:string) [
    "apple","A",
    "orange","B",
    "grapes","C"
];
words
| summarize result = strcat_array(make_list(word), ",")

this returns a single table with a single string column, whose value is: apple,orange,grapes

like image 184
Yoni L. Avatar answered Aug 30 '26 17:08

Yoni L.



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!