SQL CTE and ORDER BY affecting result set

后端 未结 2 689
忘掉有多难
忘掉有多难 2021-01-12 04:11

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

2条回答
  •  时光说笑
    2021-01-12 05:08

    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..

提交回复
热议问题