Hi all
I have a query that is mean to count the number of students who have attained a reward and total them up based on student ID. My table is as follows Student ID, Teacher Initials and Reward type. Rows created based on rewards for each student.
[table="width: 500"]
[tr]
[td]Student ID[/td]
[td]Teacher Initials[/td]
[td]Reward Type[/td]
[/tr]
[tr]
[td]213[/td]
[td]BO[/td]
[td]CH[/td]
[/tr]
[tr]
[td]213[/td]
[td]CA[/td]
[td]CH[/td]
[/tr]
[/table]
The trouble I am having is that for one particular student (213) the total for the reward types are being doubled up ( CH should be 2 but is 4). Im not sure what is causing this, the original the table is fine however when I join the table with student address details based on Student ID to link address details the total just for this one student doubles up. Is there something in MS Access that stores hidden data that needs to be removed? Or is the query wrong? The SQL code is below if anyone could take a look, I am a novice with Access so can post image of the query in design view if needed.
Thanks in advance for any help.
I have a query that is mean to count the number of students who have attained a reward and total them up based on student ID. My table is as follows Student ID, Teacher Initials and Reward type. Rows created based on rewards for each student.
[table="width: 500"]
[tr]
[td]Student ID[/td]
[td]Teacher Initials[/td]
[td]Reward Type[/td]
[/tr]
[tr]
[td]213[/td]
[td]BO[/td]
[td]CH[/td]
[/tr]
[tr]
[td]213[/td]
[td]CA[/td]
[td]CH[/td]
[/tr]
[/table]
The trouble I am having is that for one particular student (213) the total for the reward types are being doubled up ( CH should be 2 but is 4). Im not sure what is causing this, the original the table is fine however when I join the table with student address details based on Student ID to link address details the total just for this one student doubles up. Is there something in MS Access that stores hidden data that needs to be removed? Or is the query wrong? The SQL code is below if anyone could take a look, I am a novice with Access so can post image of the query in design view if needed.
Code:
SELECT Merit_tb.PupilID, Merit_tb.Type, Count(Merit_tb.Type) AS CountOfType
FROM Pupil_tb INNER JOIN Merit_tb ON Pupil_tb.PupilID = Merit_tb.PupilID
GROUP BY Merit_tb.PupilID, Merit_tb.Type;
Thanks in advance for any help.