I have written this Query
SELECT
ROW_NUMBER() OVER (ORDER BY b.s_id) as RN,
g.code as De,
f.code as Ar
from a_c a
left join ne_a b ON b.n_a_id = a.n_a_id
left join Sh d ON d.s_id = b.s_id
left join A g ON g.a_id = a.d_a_id
left join A f ON f.a_id = a.a_a_id
where b.s_id = 'MHJIX'
ORDER BY b.s_id
and it gives me result as
RN De AR
1 S D
2 D G
3 G J
I want to display results which starts from Row_Number 2 and onwards.
Row_numbers can always change. In above example there are 3 rows in total, but it can be 5 rows in some other example.
How can I display results which starts from row_number 2 and onwards?
How can I do that?
You need something like this (CTE – Common Table Expression):
Basically, you need to “wrap” your query that contains the
ROW_NUMBER()ranking function into a sub-query or CTE so that you can then reference that new “row_number” column in the outer query (to use it to limit your end result set).