I am trying to use a SQL Server 2008 Ranking Function on a query sorted by a derived column. Here's an example
SELECT
table.FirstName, table.LastName,
CalculatedValue(table.number) As Points,
ROW_NUMBER() OVER (ORDER BY points) AS 'Row Number'
FROM table
ORDER BY points
I always get an error invalid column name "points" because the OVER function does not work with aliases, based on what I've read.
Does anyone know an alternative where I can retrieve the sequential row number of a result set sorted by a derived column?