Your 'specification' is a bit unclear to me.
Quote:
quote:
what I want is the Sum(BValue) for all locations displayed on each row from Table1
|
I've read this several times and I still am not sure what you really want. I'm not sure what the relationship between the two tables has to do with all this.
Sorry. I'll just guess you want the Average BValue by location from Table2 and the sum of BValue from Table2 for all locations, and that these two values are to be returned along with the other data in each row in Table1. The two tables have some kind of relationship based on TLoc=BLoc. I have no idea what the primary keys are:
Code:
SELECT TLoc TDate TValue,
(SELECT AVG(BValue) FROM Table2 WHERE Table2.BLoc=T1.Tloc) as LocAvg,
(SELECT SUM(BValue) FROM Table2) as TotalAllLocs
FROM Table1 T1;
Jeff Mason
Custom Apps, Inc.
www.custom-apps.com