Permalink
Browse files

Clarified DataList->limit() docs

  • Loading branch information...
1 parent 317495f commit 2e6e0de44ddcadbd7a95b81c1649d6dba7091e54 @chillu chillu committed Jan 15, 2013
Showing with 3 additions and 2 deletions.
  1. +3 −2 docs/en/topics/datamodel.md
@@ -250,8 +250,9 @@ parameter to specify the offset, which allows you to tell the system where to st
offset, if not provided as an argument, will default to 0.
:::php
- // Return 5 members starting from the 5th result
- $members = Member::get()->sort('Surname')->limit(5, 4);
+ // Return 10 members with an offset of 4 (starting from the 5th result).
+ // Note that the argument order is different from a MySQL LIMIT clause
+ $members = Member::get()->sort('Surname')->limit(10, 4);
### Raw SQL options for advanced users

3 comments on commit 2e6e0de

@sunnysideup

that is a very eloquent solution Ingo. THANK YOU. Even though we should be Database Independent, I think that it is a fair expectation that most of our developers work on MySQL. What is more, there might be other Databases that use the same limit clause (e.g. Microsoft DBs?)

@halkyon
Member

MSSQL uses a completely different way of doing limits, unfortunately. It's quite complicated, and involves a sub-select.

Please sign in to comment.