Excel → T-SQL › XLOOKUP

XLOOKUP to SQL Server JOIN

XLOOKUP can return a column to the left of the key. SQL does not care about column order. Join on the key.

SELECT t.email, ISNULL(c.customer_id, 'Missing') AS customer_id
FROM Tickets t
LEFT JOIN Customers c ON c.email = t.email;

if_not_found is ISNULL or COALESCE on the joined column. Arrays of return columns are extra SELECT list items.

Canonical translation

SELECT t.email, ISNULL(c.customer_id, 'Missing') AS customer_id
FROM Tickets t
LEFT JOIN Customers c ON c.email = t.email;

Then write it on a ticket

Monday is free. A colleague asks, you type, we mark it.

Clock in free