ADX Kusto Self Join with a combination of equality and inequality

databricksuser-5173 0 Reputation points
2025-04-14T23:00:47.3466667+00:00

Hi,

How do we generate Kusto query to achieve a self-join query, where one column matches but the other doesn't?

For example:

myTable

| where myColumnSubset == "mySubGroup"

| join kind=inner (

    myTable

    | where myColumnSubset == "mySubGroup"

    | project myColumnOne, myColumnTwo, myColumnThree

)

on $left.myColumnOne == $right.myColumnOne

The above query works.

If I add below further inequality criterion, it fails

$left.myColumnTwo != $right.myColumnTwo

Thank you

Azure Data Explorer
Azure Data Explorer
An Azure data analytics service for real-time analysis on large volumes of data streaming from sources including applications, websites, and internet of things devices.
561 questions
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.