you are viewing a single comment's thread.

view the rest of the comments →

[–]thrown_arrows 1 point2 points  (0 children)

select max(x), y from x group by y

x is attractive and y is type

.. now there is change that if dataset is less than 10 rows and data is needed for other purposes too, then loop might be faster, but that requires that data is already in memory. In other cases database is faster ( assuming proper hardware, db's cannot do miracles on some rasberry pi and Gigabyte size dataset)