My question is the following:
SELECT li.nombre,
count(li.cantidad) as cantidad
FROM LINEA
GROUP BY li.nombre
The query returns this data:
Coca 19
Corona 9
Mandarina 12
Speed 8
I need a query that returns the maximum. In this case the query should return:
Coca - 19
As simple as doing an order by ordering from highest to lowest with DESC and removing only the first line with top/limit ;-)
For SQL Server :
For other databases that do not support TOP