MySQL - how do I find the row with greatest value

admin

Administrator
Staff member
I need to select the one row (or rows if there are multiples) with the largest value in that column.

It seems like this would be easy but I can't get it to work.

I'm trying this:

SELECT MAX(amount) as maxvalue FROM table_name WHERE cat_id = myvariable GROUP BY amount


Also, can someone please explain to me the difference between ORDER BY and GROUP BY. I don't quite get when you would use GROUP BY.

Thanks.
 
Back
Top