Process Flow - Common Table Expressions (CTEs)
Start Query
Define CTE with AS
CTE Executes and Stores Result
Main Query Uses CTE Result
Return Final Result
End Query
The query starts by defining a CTE, which runs first and stores its result. Then the main query uses this stored result to produce the final output.