Select id, name, ROW_NUMBER() OVER (ORDER BY id asc) as 'RowNo'
from customers
where RowNo between 50 AND 60
I am trying to select a subset of rows between 50 and 60 . The problem is ‘RowNo’ is an invalid column name.
Thank you
Using SQL SERVER 2008 R2
Use your query as subquery like bellow:
You can use CTE as well but whether to choose one over another read Difference between CTE and SubQuery? and check execution plan.