Union with aggregation functions.

Not the best solution.