如何使用PHP检查SQL中表中的最大数字

I was just wondering that, how to get the greatest number in the table. I mean i have a table called: hits; in that their are 2 columns: 1. id 2. hit

and their are many ids in the table and all have more than 10 hits, now what i want to do is to get the greatest id of the greatest hit PS: See below:

 id | hit
 ---|----
  1 | 10
  2 | 15
  3 | 45
  4 | 9
Select Id,
       Max(Hit)
       from tableName
       group by id 
       having Max(hit)=(Select Max(Hit) from TableName)

SQL FIDDLE Demo

yes you can use MAX function to use like below

Select Id,Max(hit) from yourtableName group by id having hit=Max(hit)

Wouldn't it be faster to do this:

SELECT * FROM table WHERE 1 ORDER BY hit DESC, id DESC LIMIT 1

Rather than using MAX, Especially if you have a larger table

http://www.witti.ws/blog/2011/04/06/mysqls-max-slow-5-years-later