Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Limit the output 2

Status
Not open for further replies.

tikual

Technical User
Jun 10, 2003
237
HK
Hi all,

If the selected output are 100 records, is it possible to output it 20 records each time? I want to get the result by 5 times. Thanks all!

tikual
 
Yep. Check the LIMIT clause in the documentation.

+++ Despite being wrong in every important aspect, that is a very good analogy +++
Hex (in Darwin's Watch)
 
Hi DonQuichote,

It seems that LIMIT only limits a range of output but not output 20 records each time.

tikual
 
the syntax is limit offset,amount so select 1,20 would return rows 1 to 20 ,issue select 21,20 would give you 21 to 40 and so on
 
select 21,20 would give you 21 to 40 and so on
this is a common error :)


the first parameter after LIMIT is the number of rows to skip over

so LIMIT 21,20 actually gives you rows 22 through 41

r937.com | rudy.ca
 
Yes well spotted !, if I'd read the text corectly when researching on the mysql documentation for the limit clause on the select (by typing mysql limit in google! ) I would have seen it ! [wink]
 
Thanks r937 and ingresman!

tikual
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top