A
A
AlpineMilk2019-01-17 13:40:23
Doctrine ORM
AlpineMilk, 2019-01-17 13:40:23

How to get the minimum value object in the database?

I need to get the minimum value object in a column

$qb
        ->where($qb->expr()->gt('r.dateEnd', ':today'))
        ->setParameter('today', $fromDate)
        ->orderBy('r.dateEnd', 'desc');

So I get objects whose dateEnd is greater than today, but how do I get the object of the smallest of this?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey S., 2019-01-17
@AlpineMilk

->orderBy('r.dateEnd', 'asc')->limit(1);

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question