I want to select the last 10 inserts of a table and among those 10, return the lowest value. Is it possible to do this in a single query?
Selecting the last 10 values:
SELECT id_relevo FROM relevo
ORDER BY id_relevo DESC
LIMIT 10
I want to select the last 10 inserts of a table and among those 10, return the lowest value. Is it possible to do this in a single query?
Selecting the last 10 values:
SELECT id_relevo FROM relevo
ORDER BY id_relevo DESC
LIMIT 10
Being straightforward, you can do this for example by using a subquery.
SELECT min(id_relevo) FROM
(SELECT id_relevo FROM relevo ORDER BY id_relevo DESC LIMIT 10) as minimo