Hi, I have a table in mysql database. One of the table field is named as "last". last 45356 39857 46539 you can see as above the column named "last" contain different values. I want to compare these values and get the highest value among them. I need the highest value in a variable which I want to use in a php function. I want to know how can this be done. Any help would be greatly appreciated. Thanks
SELECT `last` FROM `table_name_here` ORDER BY `last` DESC LIMIT 1 That will select the highest value in the column
If the field is indexed, it doesn't matter, but if it's not, then select max() is much faster than select order by desc limit 1.