I've got a MS Access 2007 DB with records of passed and failed attempts to pass an exam.
Student_id, Course_id, passed
S001 C001 0
S001 C001 1
S002 C001 1
S003 C001 0
'Passed' is used as a boolean where 0 is failed an 1 passed, but is stored as a number.
I want to build a query displaying the number of attempts per student per course. This can be done by averaging the number passed. S001 has an average of 0.5, S002 of 1 and S003 of 0. This would indicate that S001 passed after 2 attempts, S002 after 1, and S003 never made it.
SELECT Student_id, Course_id, avg(passed)
FROM tbl
GROUP BY Student_id, Course_id, passed
The problem is: the average's are all 0 or 1. My guess is that the number does not convert to a double (allowing for decimals). How do I cast the average in to a datatype allowing decimals?