-
Getting sum from various tables and columns
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 single query instead that will return 600. i tried using UNION to join them but i am getting all the 3 values as a recordset
Any ideas
i am using MySQL 4.1.7.
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"
Thanks
Last edited by davykiash; 06-23-2005 at 01:54 AM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|