如何汇总列的总和,其状态仅为待定

时间:2016-04-06 01:38:23

标签: php

我有这个代码来获取价格列的总数,虽然我希望它只将那些处于“声明”状态的人的总和加起来

public function getAllSales()
{
$stmt = $this->conn->prepare("Select sum(Price) AS total From tbl_orderlist");
$stmt->execute();
$result = $stmt->fetch();
return $result;


}

ClaimedList

1 个答案:

答案 0 :(得分:-1)

早些时候回答了几乎相同的问题...... LOL

Select COUNT(*) as total From tbl_orderlist WHERE status = 'Claimed';