Meaningless Drivel is fun!*
The moose likes JDBC and the fly likes SQL question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "SQL question" Watch "SQL question" New topic
Author

SQL question

Max Harding
Greenhorn

Joined: Aug 24, 2002
Posts: 2
What would be the proper SQL statement to use if I wanted to access the 11th row of a table without any comparison to data in that particular row?
Bosun Bello
Ranch Hand

Joined: Nov 06, 2000
Posts: 1510
You can access the 11th record in a result set by just looping thru the resultset and increment a counter till you reach 11.


Bosun (SCJP, SCWCD)
So much trouble in the world -- Bob Marley
Jamie Robertson
Ranch Hand

Joined: Jul 09, 2001
Posts: 1879

If you are using Oracle, you can do something like
"select id, name from ( select rownum as row_num_col, id, name from emp ) where row_num_col = 11"
To find the rownumber in a database is database specific, so the above may not work on any other platform.
Jamie
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: SQL question