I\'ve pasted a very simplified version of my SQL query below. The problem that I\'m running into is that the ORDER BY statement is affecting the select results
ORDER BY
I think you can add new column like
SELECT ROW_NUMBER() OVER(ORDER BY ;) AS RowNo
and then all your columns.. this would help you to query using the CTE anchor... using between, where etc clauses..