Sean Barzilay
Sean Barzilay

Reputation: 138

Kusto KQL equivalent to string_agg in mysql

Is there a way to concatenate a column in Kusto KQL?

For example, for some world dataset with a column name in MySQL (v8):

select group_agg(name) from world;

would result in:

| string_agg                                    |
|-----------------------------------------------|
| Afghanistan,Azerbaijan,Bahrain,Bangladesh,... |

Upvotes: 5

Views: 2134

Answers (1)

Avnera
Avnera

Reputation: 7618

Use make_set to create dynamic array of the unique values and then you can use strcat_array to get a string value of the list. For example:

StormEvents
| take 10
// get array of the distinct values
| summarize make_set(State) 
// get a string value of the array
| extend states = strcat_array(set_State, ", ")

Results: enter image description here

Upvotes: 9

Related Questions