0

Hi everyone

i need some help down here. i am trying to connect multiple db and at the same time i want to sum the value of the column. what i have right now is this

SELECT SUM(total) as branch1sales FROM icm.sales 
UNION 
SELECT sum(total) as branch2sales FROM hism.sales

its computing correctly but the problem is the branch2 alias is being invoke. what am i doing wrong? see attached image for the output

Untitled.jpg

thanks

2
Contributors
2
Replies
17
Views
2 Years
Discussion Span
Last Post by ehpratah
2

Try

SELECT  (SELECT SUM(total) FROM icm.sales)  AS branch1_sales,
        (SELECT SUM(total) FROM hism.sales) AS branch2_sales

Edited by Reverend Jim

0

@ Revjim

thank you so much for that Snippet it really do the trick. learned new thing today and i cant believe that it is possible to access other db's with out using union or some other techniques

thanks

Neil

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.