|
BeTheBall -> RE: Adding (SUM) DB Entries Together (6/8/2004 22:31:54)
|
I would add a new table to the database. Call it tblMeals. It should have two fields, MealID and then the titles, i.e., breakfast, morning snack, lunch etc. Then, in the Detail table add a new field called MealID (datatype numeric). You can then add the MealID to the current records if you wish. You will also need to add a MealID field to the form you use to insert data. I would probably go with a radio button field and assign the various MealIDs to each button. Once done the above SQL would need to become: SELECT tblMeals.MealID, tblMeals.MealName, Detail.entryNAME, Detail.entryDATE, Detail.entryDESC, Detail.entryPOINTS, SUM(Detail.entryPOINTS) AS TotalPOINTS, Individual.entrantGOAL FROM (Individual RIGHT JOIN Detail ON Individual.entrantNAME=Detail.entryNAME) INNER JOIN tblMeals ON tblMeals.MealsID=Detail.MealID GROUP BY Detail.entryNAME, Detail.entryDESC, Detail.entryPOINTS, Individual.entrantGOAL, Detail.entryDATE HAVING Detail.entryNAME='::entryNAME::' AND Detail.entryDATE='::entryDATE::' ORDER BY MealID DESC Does that help?
|
|
|
|