guanacux
06-24-2009, 10:56 AM
Hello, I'm starting to use access, is been about 5 years or so, since I've used it. Somethings are coming back as I would like them to. Here is my current problem. I have the following table:
SSN,LASTNAME,FIRSTNAME,EXAMTYPE,EXAMDATE,RESULT
Students can take the same exam at different dates, and in my query I only want to display the latest result for one particular exam.
So right now I have not only the same students taking different exams (same SSNs) but also the same student taking the same exam when he/she fails at its 1st, 2nd, etc attempt (SAME SSNs, SAME EXAMTYPE).
In esence I want a query that only shows distinct values for SSN,LASTNAME,FIRSTNAME,EXAMTYPE,EXAMDATE,RESULT where I only show the latest result whether is a pass or fail, I don't care, but it has to be the latest of a given examtype.
so the table looks like this now:
xxx-xxx-1234,Doe,John,001,1/1/2008,F
xxx-xxx-1234,Doe,John,001,2/1/2008,P
xxx-xxx-4567,Doe,Jane,002,2/1/2008,P
xxx-xxx-4567,Doe,Jane,003,2/1/2008,F
xxx-xxx-4567,Doe,Jane,003,3/1/2008,F
xxx-xxx-1346,Jobs,Steve,004,3/1/2008,P
xxx-xxx-1234,Doe,John,004,5/1/2008,P
I want a query result like these:
xxx-xxx-1234,Doe,John,001,2/1/2008,P
xxx-xxx-4567,Doe,Jane,002,2/1/2008,P
xxx-xxx-4567,Doe,Jane,003,2/1/2008,F
xxx-xxx-1346,Jobs,Steve,004,3/1/2008,P
xxx-xxx-1234,Doe,John,004,5/1/2008,P
Thank you for all your replies
SSN,LASTNAME,FIRSTNAME,EXAMTYPE,EXAMDATE,RESULT
Students can take the same exam at different dates, and in my query I only want to display the latest result for one particular exam.
So right now I have not only the same students taking different exams (same SSNs) but also the same student taking the same exam when he/she fails at its 1st, 2nd, etc attempt (SAME SSNs, SAME EXAMTYPE).
In esence I want a query that only shows distinct values for SSN,LASTNAME,FIRSTNAME,EXAMTYPE,EXAMDATE,RESULT where I only show the latest result whether is a pass or fail, I don't care, but it has to be the latest of a given examtype.
so the table looks like this now:
xxx-xxx-1234,Doe,John,001,1/1/2008,F
xxx-xxx-1234,Doe,John,001,2/1/2008,P
xxx-xxx-4567,Doe,Jane,002,2/1/2008,P
xxx-xxx-4567,Doe,Jane,003,2/1/2008,F
xxx-xxx-4567,Doe,Jane,003,3/1/2008,F
xxx-xxx-1346,Jobs,Steve,004,3/1/2008,P
xxx-xxx-1234,Doe,John,004,5/1/2008,P
I want a query result like these:
xxx-xxx-1234,Doe,John,001,2/1/2008,P
xxx-xxx-4567,Doe,Jane,002,2/1/2008,P
xxx-xxx-4567,Doe,Jane,003,2/1/2008,F
xxx-xxx-1346,Jobs,Steve,004,3/1/2008,P
xxx-xxx-1234,Doe,John,004,5/1/2008,P
Thank you for all your replies