将最大数值存储到数据库表中

时间:2017-11-16 21:22:57

标签: php mysql

我有这个代码,它是2个表的总和

<div align="right">   Total Vanzari ziua curenta: <i><strong>
<?php
$query = "SELECT (SELECT SUM(totaldeplata) FROM vanzari WHERE 
datainregistrarii  >= CURRENT_DATE()) + (SELECT SUM(totaldeplata) FROM 
players WHERE datainregistrarii  >= CURRENT_DATE()) as result";
$query_run = mysql_query($query);
$row = mysql_fetch_assoc($query_run); 
$sum = $row['result'];
echo "sum of two different column from two tables : "+ $sum;
?></strong>  </i> Lei
</div>

它显示来自2个不同表格的2行总和

有没有办法将这个最大值存储到数据库中(实际上是每日销售,因此需要将最大值存储到表格行中)

0 个答案:

没有答案