Introduction In day-to-day SQL Server development, most queries rely on familiar operators such as INNER JOIN and LEFT JOIN. These work well when data can be matched through straightforward relationships between tables. Some requirements are less straightforward. For example, you might need to return the most recent order for each customer or retrieve the top N rows within each group. These problems can be solved in several ways, but the resulting queries are not always easy to read.