There are two fields in database table A, one is the category, and the other is the price
How to calculate the highest value, lowest value, and average price of No. 11 in the category in PHP
One category corresponds to N pieces of price data such as
11, 100
2, 120
11, 101
11, 101
11, 55
11, 99
5, 88
2, 103
11, 170
5, 98
伊谢尔伦2017-05-18 10:53:53
//数据库连接省略
$data=mysql_query("select MAX(price),MIN(price),AVG(price) from goods where category=11");
$row_data=mysql_fetch_row($data);
echo 'MAX:'.$row_data[0].' MIN:'.$row_data[1].' AVG'.$row_data[2];
伊谢尔伦2017-05-18 10:53:53
I think it will be easier to find the answer if you remove php when searching and simply think of it as a sql question