Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

SQL question

 
Max Harding
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1510
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can access the 11th record in a result set by just looping thru the resultset and increment a counter till you reach 11.
 
Jamie Robertson
Ranch Hand
Posts: 1879
MySQL Database Suse
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic