Konrad Jamrozik
Konrad Jamrozik

Reputation: 3556

How to concatenate columns for one row without enumerating them?

Given:

let table1 = datatable (col1:string, col2:string)
["abc","def"]
;
let table2 = datatable (col3:string, col4:string)
["ghi","jkl"]

where table1 | union table2 gives:

col1 col2 col3 col4
abc  def
          ghi jkl

how to get this instead?

col1 col2 col3 col4
abc  def  ghi jkl

Assume there might be many more columns, so any solution requiring enumerating all of them doesn't work.

Related question:
Is there a way to combine data from two tables in Kusto?

Upvotes: 1

Views: 237

Answers (1)

Konrad Jamrozik
Konrad Jamrozik

Reputation: 3556

One solution I know of is:

table1 | extend pivot="" 
| join kind=innerunique (table2 | extend pivot = "") on pivot
| project-away pivot*

Upvotes: 1

Related Questions