T
Tom Cunningham
I have four queries, each containing students scores which are grouped by week using the DatePart function. I would like to create a query to total scores from each query by week. Basically, IF Week = 10 SUM QueryA, QueryB, QueryC, QueryD. Below is an example of the four queries which I would like to bring together based on the week. I currently have them joined on ID and on WEEK.
Qry_TIMETable_A
ID# LASTNAME WEEK ATTENDANCE
34 Smith 10 25
42 Johnson 11 45
51 Badley 12 30
Qry_TIMETable_B
ID# LASTNAME WEEK ATTENDANCE
34 Smith 10 35
42 Johnson 11 40
51 Badley 12 20
Qry_TIMETable_C
ID# LASTNAME WEEK ATTENDANCE
34 Smith 10 20
42 Johnson 11 15
51 Badley 12 25
Qry_TIMETable_D
ID# LASTNAME WEEK ATTENDANCE
34 Smith 10 20
42 Johnson 11 40
51 Badley 12 35
From these four queries I would like to create one query which contains student?s totals by week. For example: IF WEEK=10 then SUM ATTENDANCE from each of the four queries. This would populate the WEEK TEN column. The next column would be, IF WEEK=11 then SUM ATTENDANCE from each of the four queries. This would continue on?.Below is an example of what I?m looking for.
QryWEEKTotal
ID# LASTNAME WEEK_10 WEEK_11 WEEK_12??.
34 Smith 100
42 Johnson 140
51 Badley 110
In the actual query students have scores for each week so it wouldn?t look so sparse but this is basically it. I have gotten some help with the use of an IF then SUM expression but have not been able to get it to work and hoped that a clearer picture of what I was doing would help.
Thank you in advance for your assistance.
Tom
Qry_TIMETable_A
ID# LASTNAME WEEK ATTENDANCE
34 Smith 10 25
42 Johnson 11 45
51 Badley 12 30
Qry_TIMETable_B
ID# LASTNAME WEEK ATTENDANCE
34 Smith 10 35
42 Johnson 11 40
51 Badley 12 20
Qry_TIMETable_C
ID# LASTNAME WEEK ATTENDANCE
34 Smith 10 20
42 Johnson 11 15
51 Badley 12 25
Qry_TIMETable_D
ID# LASTNAME WEEK ATTENDANCE
34 Smith 10 20
42 Johnson 11 40
51 Badley 12 35
From these four queries I would like to create one query which contains student?s totals by week. For example: IF WEEK=10 then SUM ATTENDANCE from each of the four queries. This would populate the WEEK TEN column. The next column would be, IF WEEK=11 then SUM ATTENDANCE from each of the four queries. This would continue on?.Below is an example of what I?m looking for.
QryWEEKTotal
ID# LASTNAME WEEK_10 WEEK_11 WEEK_12??.
34 Smith 100
42 Johnson 140
51 Badley 110
In the actual query students have scores for each week so it wouldn?t look so sparse but this is basically it. I have gotten some help with the use of an IF then SUM expression but have not been able to get it to work and hoped that a clearer picture of what I was doing would help.
Thank you in advance for your assistance.
Tom