I have the following query:
SELECT adate, sum(b), sum(c), sum(d)
FROM
(
(
SELECT a.adate, sum(b), sum(c), sum(d)
FROM one
WHERE a='aa'
GROUP BY a.adate
)
UNION ALL
(
SELECT a.adate, sum(b), sum(c), sum(d)
FROM two
WHERE a='aa'
GROUP BY a.adate
)
UNION ALL
(
SELECT a.adate, sum(b), sum(c), sum(d)
FROM three
WHERE a='aa'
GROUP BY a.adate
)
UNION ALL
(
SELECT a.adate, sum(b), sum(c), sum(d)
FROM four
WHERE a='aa'
GROUP BY a.adate
)
) a
GROUP BY a.adate
I basically want to sum fields across four tables.
Is this a good query to do this?
Is there a better way of doing that?