计算价格合计

时间:2019-05-21 16:35:47

标签: mysql count

我如何更改此SQL代码,以便将所有添加的价格相互计算并求和? 我回应$ count6 帮助会非常有用,谢谢

// Total price : projecten > price
$query = "SELECT COUNT(*) as countvar FROM projecten where price;";
$result = mysqli_query($mysqli,$query);
$row = mysqli_fetch_array($result);
$count6= $row['countvar'];

好的,我有

// Total price : projecten > price
$query = "SELECT price, SUM(amount) AS total_amount FROM projecten";
$result = mysqli_query($mysqli,$query);
$row = mysqli_fetch_array($result);
$count6= $row['total_amount'];

我回声$ count6 没事

0 个答案:

没有答案