I have a union of two separate tables that are summed using a group by. I want a consolidated sum recognizing the...
By submitting your personal information, you agree that TechTarget and its partners may contact you regarding relevant content, products and special offers.
Table A x 2 x 1 y 1
Table B x 2 y 3 y 2
Here is the result that i desire --
x 5 y 6
My sql does not work
select colA, sum(colB) from A group by colA union select colA, sum(colB) from B group by colA
Instead of my desired results, I am getting duplicate x and y rows.
Dig Deeper on Oracle and SQL
Have a question for an expert?
Please add a title for your question
Get answers from a TechTarget expert on whatever's puzzling you.