A
A
agent11562017-02-01 12:48:44
MySQL
agent1156, 2017-02-01 12:48:44

How to start displaying from the table starting from 3 by id from the end?

I know there is one($id) method. But if you don't know the id, but you just need to display starting from 3 in the id count from the end?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
V
Vadim, 2017-02-01
@ShVad

Use LIMIT 0, 3 and ORDER by id desc.

M
Maxim Timofeev, 2017-02-01
@webinar

MyModel::find()->orderBy('id DESC')->limit(3)->all();

sort by id in reverse order, select 3 records.

A
Andrey, 2017-02-01
@reaferon

MyModel::find()->orderBy('id DESC')->limit(10)->offset(3)->all();

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question