The Question
SQL
Identifying Multi-Year Customer Retention
Given a table of tax filing transactions containing filing IDs, user IDs, filing dates, and product names, write a query to identify all users who have demonstrated brand loyalty by filing with any 'TurboTax' product for at least three consecutive calendar years. Ensure the results are deduplicated at the user-year level and the final list of user IDs is sorted in ascending order.
Clickhouse
CTE
Window Func
LAG
toYear
DISTINCT
ILIKE
March 30, 2026