I have a set of tables including Reps, Teams, Errors, Error Log. Error Log lists all errors made by a rep. Each rep is in a team. Each rep has an Edge ID (user number) Each different type of error has a points value (stored in the errors table).
I have this query in Access to total the points value for each rep in a team between two dates:
SELECT
Reps.Forename
, Reps.Surname
, [Error Log].[Edge ID]
, Teams.[Team Code]
, Sum(Errors.Points) AS SumOfPoints
FROM Teams
INNER JOIN (
Reps INNER JOIN (
Errors INNER JOIN [Error Log]
ON Errors.[E&CD code] = [Error Log].[E&CD Code])
ON Reps.[Edge ID] = [Error Log].[Edge ID])
ON Teams.[Team Code] = Reps.[Team Code]
WHERE
((([Error Log].[Date Logged]) Between [Error logged from: (dd/mm/yyyy)] And [Error logged to: (dd/mm/yyyy)])
AND
((Teams.[Team Code])=[Team Code:]))
GROUP BY
Reps.Forename
, Reps.Surname
, [Error Log].[Edge ID]
, Teams.[Team Code]
ORDER BY
Sum(Errors.Points) DESC;
I want to give each rep a grade dependant on their number of points, where: 0-4 points = grade 3, 5-9 = 4 and 10+ = 5
How can I code this (SELECT CASE perhaps)? I've been trying for the last hour but can't get it right!
Thanks for any help.