MySQL Forums
Forum List  »  Newbie

sum from various tables
Posted by: David Kagiri
Date: June 27, 2005 02:05AM

i have three queries below. when i run them they work fine. they return the values 100,200 and 300 respectively.However i would like to run a query that will return 600. i tried using UNION but i am getting the 3 values

How did u do it in SQL Server.Is it possible in the first place?

SELECT sum(consultation)+ sum(laboratory) FROM nairobi,familymembers WHERE
familymembers.dependantid = nairobi.memberid and familymembers.memberid = "AKI100000001"


SELECT sum(consultation)+ sum(laboratory) FROM rift,familymembers WHERE
familymembers.dependantid = rift.memberid and familymembers.memberid = "AKI100000001"

SELECT sum(consultation)+ sum(laboratory) FROM coast,familymembers
familymembers.dependantid = coast.memberid and familymembers.memberid = "AKI100000001"

Any ideas?

Options: ReplyQuote


Subject
Written By
Posted
sum from various tables
June 27, 2005 02:05AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.