_JSincliar
Registered User.
- Local time
- Today, 12:35
- Joined
- Dec 9, 2009
- Messages
- 16
I have a table of names and points: Name -- Pts1 -- Pts2 -- etc
I have a second table which I would like to store the sum of all the points in a record.
Table 1
Name1 -- Pts1 -- Pts2
Name2 -- Pts1 -- Pts2
Table 2
Name1 -- TotalPts
Name2 -- TotalPts
I am trying to perform the calculation and update Table 2 for different groups of records. (Name1, Name2, Name 3 are in Group1; Name 4, Name5, Name6 are in Group2). Below calculates the sum of 1 record as an example but I would like an update or insert into query to store the data. There are 29 points fields.
Thanks
I have a second table which I would like to store the sum of all the points in a record.
Table 1
Name1 -- Pts1 -- Pts2
Name2 -- Pts1 -- Pts2
Table 2
Name1 -- TotalPts
Name2 -- TotalPts
I am trying to perform the calculation and update Table 2 for different groups of records. (Name1, Name2, Name 3 are in Group1; Name 4, Name5, Name6 are in Group2). Below calculates the sum of 1 record as an example but I would like an update or insert into query to store the data. There are 29 points fields.
Thanks
Code:
SELECT T1_StudentActivities_Tbl.USED_NAME,T1_StudentActivities_Tbl.Group,
(NZ(T1_StudentActivities_Tbl.[T1_TT_1_Pts], 0) + NZ(T1_StudentActivities_Tbl.[T1_TT_2_Pts],0) +
NZ(T1_StudentActivities_Tbl.[T1_TT_3_Pts],0) + NZ(T1_StudentActivities_Tbl.[T1_TM_1_Pts],0) +
NZ(T1_StudentActivities_Tbl.[T1_TM_2_Pts],0) + NZ(T1_StudentActivities_Tbl.[T1_AthR_1_Pts],0) +
NZ(T1_StudentActivities_Tbl.[T1_AthR_2_Pts],0) + NZ(T1_StudentActivities_Tbl.[T1_AthR_3_Pts],0) +
NZ(T1_StudentActivities_Tbl.[T1_AthR_4_Pts],0) + NZ(T1_StudentActivities_Tbl.[T1_AthR_5_Pts],0) +
NZ(T1_StudentActivities_Tbl.[T1_AthR_6_Pts],0) + NZ(T1_StudentActivities_Tbl.[T1_AthR_7_Pts],0) +
NZ(T1_StudentActivities_Tbl.[T1_ChBa_1_Pts],0) + NZ(T1_StudentActivities_Tbl.[T1_ChBa_2_Pts],0) +
NZ(T1_StudentActivities_Tbl.[T1_ChBa_3_Pts],0) + NZ(T1_StudentActivities_Tbl.[T1_ChBa_4_Pts],0) +
NZ(T1_StudentActivities_Tbl.[T1_Club_1_Pts],0) + NZ(T1_StudentActivities_Tbl.[T1_ArtR_1_Pts],0) +
NZ(T1_StudentActivities_Tbl.[T1_ArtR_2_Pts],0) + NZ(T1_StudentActivities_Tbl.[T1_ArtR_3_Pts],0) +
NZ(T1_StudentActivities_Tbl.[T1_Committee_1_Pts],0) + NZ(T1_StudentActivities_Tbl.[T1_Committee_2_Pts],0) +
NZ(T1_StudentActivities_Tbl.[T1_Committee_3_Pts],0) + NZ(T1_StudentActivities_Tbl.[T1_Committee_4_Pts],0) +
NZ(T1_StudentActivities_Tbl.[T1_ServR_1_Pts],0) + NZ(T1_StudentActivities_Tbl.[T1_ServR_2_Pts],0) +
NZ(T1_StudentActivities_Tbl.[T1_ServR_3_Pts],0) + NZ(T1_StudentActivities_Tbl.[T1_ServR_4_Pts],0) +
NZ(T1_StudentActivities_Tbl.[T1_ServR_5_Pts],0)) AS TotalPts
FROM T1_StudentActivities_Tbl;
Last edited: