是否可以在另一个MySql SUM()函数中使用MySql SUM()函数?
像下面
$query="SELECT SUM(Table1.Column1+SUM(Table2.Column2+Table2.Column3)) from Table1 LEFT JOIN Table2 ON Table1.id = Table2.table1_id WHERE Table1.Column2='Test'";
谢谢
您只需要一个SUM():
SUM()
SELECT SUM(Table1.Column1 + Table2.Column2 + Table2.Column3) ...
或SUM()在每个字段上使用:
SELECT SUM(Table1.Column1) + SUM(Table2.Column2) + SUM(Table2.Column3) ...