cancel
Showing results for 
Search instead for 
Did you mean: 

To select Nth record in the table

0 Kudos

Dear all,

I have requirement in HANA SQL stored procedure to select the Nth record from the table. The number "N" is derived based on some conditions in the SQL.

Could you please help in framing out the query.

Regards,

Yogesh

View Entire Topic
former_member182114
Active Contributor
0 Kudos

Hi Yogesh,

The best option to solve your question seems to be OFFSET and LIMIT from SELECT statment.

SELECT - SQL Reference - SAP Library

Inside your procedure you can find the Nth number you want and use it as offset with -1. If you only wat one row so LIMIT to 1, or obtain how many you want later.

Regards, Fernando Da Rós

0 Kudos

Hi Fernando,

Thanks for your help. I tried with your approach. It works for me.

Regards,

Yogesh