T
T
Troodi Larson2018-11-06 17:23:16
MySQL
Troodi Larson, 2018-11-06 17:23:16

How to take the minimum price from the last 100 rows?

How to take the minimum price from the last 100 rows? It is desirable to do with the help of Eloquent.
Wanted to do something like:

orderByDesc('id')->limit(100)->orderBy('price', 'asc')->first()

Of course, this is not true. How can you do it right?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander Pushkarev, 2018-11-06
@troodi

...->orderByDesc('id')->limit(100)->min('price')

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question