Unionall to merge queries

Hi,
I have a query which is using unionall to merge the results of two queries. I am getting something like:
e1

While I would like to get something like this:
NAME,CODE1,CODE2
A,10,30
B,30,5
C,40,100

How can I solve?

Thanks in advance,