I ask for help with mySQL query.
There are several tables (tab1, tab2, tab3, tab4) in each there are columns:
| vol | price | date |.
It is necessary to calculate the sum of the products of all rows (total) of each table, in different columns as a result, for today.
SELECT SUM query (vol * price) AS Stab1 FROM tab1 WHERE date = Date, if applied to each, gives the desired result ...
I do not think how to combine, I tried this:
SELECT SUM (t1.price * t1.vol) AS Stab1, SUM (t2.price * t2.vol) AS Stab2 FROM tab1 t1, tab2 t2 ...
- the first column is correct, the other crazy numbers.
each SELECT to the table combining through UNION displays everything in one column ....
total needed:
| Stab1 | Stab2 | Stab3 | Stab4 |
amount amount amount amount