Hi Ruiwen,

See also 'orderby' in the book. Do something like this:

db().select(db.person.ALL, orderby=~db.yourtable.created_date,
limitby=(0, 15))

Don't overlook the tilde (~), this is important because it makes
reverse order i.e. latest dates first

-D

On Nov 13, 10:10 am, Ruiwen Chua <[email protected]> wrote:
> Hi,
>
> I have a table full of records and would like to retrieve only the 15
> most recent records, sorted by their creation date.
>
> I've tried using the limitby= argument to select() in the DAL, but the
> online book only shows one example that uses limitby to select 2
> records starting from 0, ie. limitby=(0,2).
>
> However, if I'd like to select the 15 most recent records, the
> database offset most likely isn't going to be 0. What should I pass to
> limitby in this case?
>
> //Ruiwen

Reply via email to