我有一个名为' test'的sql视图就像,
Name Profession
Mak Manager
San Doctor
我需要添加一个序列列,使其看起来像,
Srno Name Profession
1 Mak Manager
2 San Doctor
现在我需要根据序列SrNo查询
Select * from test where SrNo between 1 and 5.
但这不起作用
答案 0 :(得分:1)
试试这个
With CTE1 AS(
SELECT row_number() over (order by (select NULL)) as Sr_no,Name,Profession
from table_Name)
Select * From cte1 where Sr_No between 1 and 5.