Sybase Sql Query for displaying 10 to 20 records (pagination)

Hi Experts,

Can you please help to wrtie a query in sybase database.

For example result Select * from emp returns 100 rows.
I need queries to display first 1 to 20 and another query to display 20 to 40 etc.

Please help me on this.

Who is Participating?
bretConnect With a Mentor Commented:
select <primary key column>, rownum = identity(20) into #temp from emp
select e.* from emp e, #temp t where =
and t.rownum >= 10
and t.rownum < 21
gannevAuthor Commented:
Am a beginner, and am not understanding that.

Can you please write a simple code snippet for
select 10 to 20 records from emp table.

Appreciate your help
gannevAuthor Commented:
Hi Bret,

Thanks for this solution. It is working greatly. But this would lead me to write procedure.
I need a sql query for this. And I can call that query from my application(java appliction).

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.