On Wed, 22 Jun 2005 09:55:39 -0400, [EMAIL PROTECTED] said: > Jochem van Dieten <[EMAIL PROTECTED]> wrote on 06/22/2005 07:34:30 AM: > > > On 6/22/05, David Kagiri wrote: > > > When i run the queries below they all work just fine > > > > > > SELECT sum(consultation)+ sum(laboratory) FROM nairobi, > > familymembers WHERE familymembers.dependantid = nairobi.memberid and > > familymembers.memberid = "AKI00001" > > > > > > SELECT sum(consultation)+ sum(laboratory) FROM riftvalley, > > familymembers WHERE familymembers.dependantid = riftvalley.memberid > > and familymembers.memberid = "AKI00001" > > > > > > SELECT sum(consultation)+ sum(laboratory) FROM coast,familymembers > > WHERE familymembers.dependantid = coast.memberid and familymembers. > > memberid = "AKI00001" > > > > > > But i would like to run the querys above as one query that will > > return a value that will be equivalent to the sum of the values of > > those queries. i hope its possible. is it? i am using MySQL version > 4.1.7 > > > SELECT sum(consultation)+ sum(laboratory) > > FROM familymembers fm > > INNER JOIN coast ON fm.dependantid = coast.memberid > > INNER JOIN riftvalley ON fm.dependantid = riftvalley.memberid > > INNER JOIN nairobi ON fm.dependantid = nairobi.memberid > > WHERE fm.memberid = "AKI00001" > > > Jochem >
Excuse my mathematical impreciseness, but when you say "sum" - could you use UNION? I've "patched together" many queries using UNION with useable results - would that help? See: http://www.w3schools.com/sql/sql_union.asp Lee G. -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]