Eirikur Eiriksson (7/8/2014)
No need to complicate things, the only thing needed here is correct window specification for the row_number function.😎 ...This brings the cost of execution for this code down to aprox. 5% of the previous code.
Very well done sir!
-- Itzik Ben-Gan 2001