如何使用php从sql回显一整天的最高值一厘米

How to echo highest value of a centimeter for the whole day from SQL using PHP

this is my database :

-------------------------------
id | date       | centimeter  
------------------------------
1  | 2014-01-31 | 160    
2  | 2014-02-28 | 800   
3  | 2017-03-31 | 23   
4  | 2016-04-30 | 130 
5  | 2016-04-30 | 600 
6  | 2017-03-31 | 700  
7  | 2014-03-28 | 200  

i want to echo it in PHP this way :

2017-03-31  700 
2016-04-30  600 
2014-03-28  200 

*i want to echo only 1 highest centimeter by day

select date, max(centimeter)
from your_table
group by date

using PDO

$SQL = "SELECT date , MAX(centimeter) FROM TABLE_NAME GROUP BY date";

$connection = new PDO('mysql:host=HOST;dbname=DB_NAME;charset=utf8', 'USER_NAME', 'PASSWORD');
$stmt = $connection->prepare($SQL)
if($stmt)
{
  $result = $stmt->fetchAll(PDO::FETCH_ASSOC);
  var_dump($result);
}

You can try this may be it will help you

SELECT date, MAX(centimeter) from table_name GROUP BY by date ORDER BY date DESC;

select max(mytbl.centimeter) as centimeterMax, SUBSTR(mytbl.date, 9,2) as DayOnly from ( SELECT * FROM mytbl) as mytbl group by DayOnly