Link to home
Start Free TrialLog in
Avatar of Francisco
FranciscoFlag for Japan

asked on

sybase sql - how to sum up UNION records

I like to sum up two sql results into one in one shot.

there are two tables, both has same columns but data records are different
I would like to see one line result as total sum value instead of two lines.
select
key,
sum(columnA)
from table A
group by key
UNION
select
key,
sum(columnA)
from table B
group by key

would you advise how this can be made...?
ASKER CERTIFIED SOLUTION
Avatar of Jan Franek
Jan Franek
Flag of Czechia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Francisco

ASKER

thank you very much it works!