For the order by problem, it seems to be linked with http://stackoverflow.com/questions/2390142/in-sql-server-how-can-i-use-row-number-with-a-subquery-column
For the order by problem, it seems to be linked with http://stackoverflow.com/questions/2390142/in-sql-server-how-can-i-use-row-number-with-a-subquery-column