Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

sql Limit

 
michael yue
Ranch Hand
Posts: 204
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi I have some problem with mysql sql statement. When i use the limit sql function it just gets the whole records starting instead of traversing it. Example "select * from MOD1 limit 140,160"; output 160 records instead of from record number 140 till 160. Am i making any mistake here? Does limit really function this way?
 
michael yue
Ranch Hand
Posts: 204
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry just figure out the problem already. Just ignored previous problem.
Now I want to know how db2 support the limit statement for mysql. Thanks.
 
Lu Battist
Ranch Hand
Posts: 104
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
For db2, I'm only aware of a "fetch first ? rows only" clause. Which is significantly different than the limit functionality you are describing. However, used with an appropriate where and order by clause it should get the job done.
 
michael yue
Ranch Hand
Posts: 204
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Would you be kind enough to give some sql examples of the above mentioned solution? I am unable to come up with anything using order and where with fetch to get a specific portion of records in db2 database. Maybe some hints.
Thanks a lot
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic