SELECT YEAR, MONTH, WEEK, DAY, SUM(AMOUNT) FROM
(
SELECT YEAR, MONTH, WEEK, DAY, AMOUNT FROM TABLE1
UNION
SELECT YEAR, MONTH, WEEK, DAY, AMOUNT FROM TABLE2
)
GROUP BY YEAR, MONTH, WEEK, DAY
Any ideas how to make this work?
InterBase does not support derived tables. Create a view with the UNION
then select from the view. Unless you want duplicates dropped use UNION
ALL for better performance.
--
Bill Todd (TeamB)
Thanks Bill.