According to the docs, common sense and some manuals on common SQL the max
function returns only maximum value. So the correct way to select the row(s) with the maximum value is a subquery:
select * from `table` where `a`=(select max(`a`) from `table`);
It's inefficient. Are there something like argmax
in SQLite?
According to the docs, SQLite allows to select the entire row with max()
:
SELECT *, max(a) FROM MyTable;
(This is supported since version 3.7.11.)
It is. Just use
select max(`a`), * from `table`;
if a single row is enough for you. The rest of values will belong to the row from which the maximum value is taken.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With