Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to get a number of record from the Resultset

 
Robert Smith
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
how to get a number of record from the Resultset ? for example , from 10 rows to 20 rows records ,please give me some examples!
thanks!
 
Lasse Koskela
author
Sheriff
Posts: 11962
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"skyspeed skyspeed",
Your more than welcome to the JavaRanch but your display name does not comply with our naming policy so I'll have to ask you to change it.
Thanks.
 
Sainudheen Mydeen
Ranch Hand
Posts: 218
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
Inside while(rs.next()) loop you can write a logic to skip the first 9 records and the records after 20.
-Sainudheen
 
Joe Ess
Bartender
Posts: 9300
10
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If your database supports the TOP keyword you can use a subquery to ORDER BY x ASC and get the top 20, and have the outer query ORDER BY x DESC and get the top 10.
 
Robert Smith
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks !
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic