File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JDBC and the fly likes sql Limit Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "sql Limit" Watch "sql Limit" New topic
Author

sql Limit

michael yue
Ranch Hand

Joined: Nov 20, 2003
Posts: 204
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

Joined: Nov 20, 2003
Posts: 204
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

Joined: Feb 17, 2003
Posts: 104
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

Joined: Nov 20, 2003
Posts: 204
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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: sql Limit
 
Similar Threads
limit clause in MS SQL
retrieve a int from backbean and dinamically work with it in the .xhtml in very bizarre way
AJAX - XML File Max Size?
dynamic pagging
inserting data in mysql in sorting order of date column