alecks Posted February 19, 2007 Share Posted February 19, 2007 I want to query a table (mysql) and fetch all information from rows starting at a specific row. How would I do this? ex: (rows I want to get info from are bolded) Mysql Table 1 info 2 info 3 info 4 info 5 info 6 info 7 info 8 info 9 info ... etc More specifically, what would the query have to be like? mysql_query(SELECT * FROM `table` WHERE...) Quote Link to comment Share on other sites More sharing options...
Jessica Posted February 19, 2007 Share Posted February 19, 2007 Using LIMIT and OFFSET. Quote Link to comment Share on other sites More sharing options...
tom100 Posted February 19, 2007 Share Posted February 19, 2007 Use the limit tag. SELECT * FROM TABLE WHERE CONDITIONS LIMIT STARTROW,NumberOfRows Doh, beat me to it... [Edit] Quote Link to comment Share on other sites More sharing options...
Balmung-San Posted February 19, 2007 Share Posted February 19, 2007 Use the limit tag. SELECT * FROM TABLE WHERE CONDITIONS LIMIT STARTROW,NumberOfRows Doh, beat me to it... [Edit] Other way around. It's LIMIT NumRows,Offset. Quote Link to comment Share on other sites More sharing options...
tom100 Posted February 19, 2007 Share Posted February 19, 2007 I beg to differ. SELECT * FROM `myTable` LIMIT 0, 10 That would return starting at row 0 and display 10 results. Therefore it would be offset,numrows. Quote Link to comment Share on other sites More sharing options...
Jessica Posted February 19, 2007 Share Posted February 19, 2007 Hence, why you use LIMIT and OFFSET. So you don't get confused. The MySQL site seems to be down right now. Quote Link to comment Share on other sites More sharing options...
Balmung-San Posted February 19, 2007 Share Posted February 19, 2007 I just looked at the MySQL docs for 4.1, and it had it that way. But I clearly remember in the 5.0 docs that it had it my way. I'm currently working on loading the 5.0 docs, so I'll edit this when they finally decide to load. [EDIT]Well it seems like 5.0 is the same way. Too many different syntaxes to remember. Sorry about that. Though I think jesirose is right. Should just use LIMIT and OFFSET to avoid confusion. Quote Link to comment Share on other sites More sharing options...
hitman6003 Posted February 19, 2007 Share Posted February 19, 2007 Google cache: http://209.85.165.104/search?q=cache:jAL3ZxHyUQcJ:dev.mysql.com/doc/en/SELECT.html+mysql+limit&hl=en&ct=clnk&cd=1&gl=us Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.