我有一个脚本,可以在te字段中总结所有内容" total"还可以。
$cleaner = $connection->query("SELECT *,SUM(total) as total FROM ventas where fecha='$datenow'");
但 我想创建更多过滤器,当caja是钉子
$cleanerx = $connection->query("SELECT *,SUM(total) as total FROM ventas where fecha='$datenow' and caja='NAILS'");
为什么不工作,我在php阅读教程,但我不明白为什么不工作。
答案 0 :(得分:1)
$cleaner = $connection->query("SELECT *,SUM(total) as total,(SELECT SUM(total) as total FROM ventas where fecha='$datenow' and caja='NAILS') as totalnails FROM ventas where fecha='$datenow'");