VeriKQL by Kaushik Saha

Level 0 · Your toolkit · Card 8 of 9 · by Kaushik Saha

Combine tables

Commands union · join

What these commands do

CommandWhat it doesShape
unionStacks the rows of two or more tables or queriesunion TableA, TableB
joinPuts rows side by side when a key matchesA | join kind=inner B on Key
kind=innerKeeps keys found on both sidesjoin kind=inner
kind=leftouterKeeps every left row, with blanks where the right has no matchjoin kind=leftouter
kind=leftantiKeeps left rows with no match on the right: "in A but not in B"join kind=leftanti

In a real workspace you join different tables, such as SigninLogs with AuditLogs, and union sign-in tables such as SigninLogs and AADNonInteractiveUserSignInLogs. This course has one table so far, so the examples join two questions about it.

See them work

union stacks two results into one, here the sign-ins from each attacking address:

union
    (SigninLogs | where IPAddress == "198.51.100.23" | summarize SignIns = count() | extend Attack = "spray"),
    (SigninLogs | where IPAddress == "203.0.113.45" | summarize SignIns = count() | extend Attack = "brute force")
| project Attack, SignIns
✓ Verified by VeriKQLKusto.Language 12.4.1 · bundle 2026.10.29

Result on the sample · 2 rows

AttackSignIns
spray12
brute force11

Failures and successes per address, side by side. leftouter keeps the address that never succeeded, with a blank:

let Failures = SigninLogs | where ResultType != "0" | summarize Fails = count() by IPAddress;
let Successes = SigninLogs | where ResultType == "0" | summarize OK = count() by IPAddress;
Failures
| join kind=leftouter Successes on IPAddress
| project IPAddress, Fails, OK
| sort by Fails desc
✓ Verified by VeriKQLKusto.Language 12.4.1 · bundle 2026.10.29

Result on the sample · 4 rows

IPAddressFailsOK
198.51.100.2312
203.0.113.4583
192.0.2.20339
192.0.2.10254

Addresses that failed and never once succeeded, with leftanti:

let Succeeded = SigninLogs | where ResultType == "0" | distinct IPAddress;
SigninLogs
| where ResultType != "0"
| distinct IPAddress
| join kind=leftanti Succeeded on IPAddress
✓ Verified by VeriKQLKusto.Language 12.4.1 · bundle 2026.10.29

Result on the sample · 1 row

IPAddress
198.51.100.23

That is the spray: it never got in.

Your turn

Which users signed in from both the Netherlands (NL) and the US? Use two let lists and a join kind=inner.

Write it in the box below and check it. Then compare with one answer; others can be right too.

Show one answer
let InNL = SigninLogs | where Location == "NL" | distinct UserPrincipalName;
let InUS = SigninLogs | where Location == "US" | distinct UserPrincipalName;
InNL
| join kind=inner InUS on UserPrincipalName
| project UserPrincipalName
✓ Verified by VeriKQLKusto.Language 12.4.1 · bundle 2026.10.29

Result on the sample · 1 row

UserPrincipalName
alex.morgan@contoso.com

Check your own query

Write your query for the task above and check it against the real schema.

All data on this page is sample data, made up for this course. The IP addresses come from ranges reserved for documentation, and the people and the company are fictional.

Card by Kaushik Saha. Every query checked with Microsoft.Azure.Kusto.Language 12.4.1 against schema bundle 2026.10.29; every result computed on the course's sample with Kusto-Loco 1.4.9, an open-source KQL engine (credits). The story's clock reads 12:00 UTC on 10 June 2026.