Page is a not externally linkable
Pollos - 8:55 pm on Nov 14, 2011 (gmt 0)
SELECT cost FROM table2011 WHERE date BETWEEN date1 AND date2
UNION ALL
SELECT cost FROM table2012 WHERE date BETWEEN date1 AND date2
Works great and gives the correct results. Using the last two days of 2011 and the first two days from 2012, gives:-
15.00
15.00
10.00
10.00
Which is correct, but if I use
$query_test3 ="
SELECT *, SUM(cost) FROM table2011 WHERE date BETWEEN date1 AND date2
UNION ALL
SELECT *, SUM(cost) FROM table2012 WHERE date BETWEEN date1 AND date2
";
The result is way off, any ideas why