patient_id:1,2,3,4,5,6,7,8,9,10
$result2=mysql_query("select max(patient_id) as maximum from outdoor");
$row2= mysql_fetch_array($result2);
echo $res=$row2['maximum'];
最大数量为9而不是10。
答案 0 :(得分:1)
试试这个
$sql = "select max(CONVERT(patient_id,UNSIGNED INTEGER)) as maximum from outdoor";
答案 1 :(得分:0)
使用此
$sql = "select GREATEST(patient_id) as maximum from outdoor";
例如:
SELECT GREATEST(2,1);