Closest Match with Sort Rewinds
A SQL Server sort operator can replay its results, but only when the sort operates on at most one row. This article employs a sort to avoid a table spool in a query designed to find the closest match to a given value in a second table.