MYSQL中用SUM函数求和,如何将结果输出在页面上?

2024-12-25 11:36:09
推荐回答(1个)
回答1:

$sql = "SELECT SUM(COST) sum FROM LIST";

$res = mysql_query($sql);
$row = mysql_fetch_assoc($res);

echo $row['sum'];