Is it possible to use MySql SUM() function inside another MySql SUM() function ??
Like below
$query=\"SELECT SUM(Table1.Column1+SUM(Table2.Column2+Table2
From basic math a + b + c = a + (b + c)
So just use one sum. It will be equivalent with what you are doing there ..
You just need one SUM()
:
SELECT SUM(Table1.Column1 + Table2.Column2 + Table2.Column3) ...
Or use SUM()
on each field:
SELECT SUM(Table1.Column1) + SUM(Table2.Column2) + SUM(Table2.Column3) ...