$query = "SELECT agent_id, SUM(amount) FROM bill WHERE YEAR(date) = YEAR(CURDATE()) AND MONTH(date) = MONTH(CURDATE()) GROUP BY agent_id";
$result = mysql_query($query) or die(mysql_error());
// Print out result
while($row = mysql_fetch_array($result)){
echo "Total ". $row['agent_id']. " = $". $row['SUM(amount)'];
echo "<br />";
}
数据库结构图像:
我想知道如何显示支票和金额的总和目前仅作为金额的总和