I have three MySql tables:
Users: UserId, UserName
Tests: TestId, TestName
Passes: PassId, UserId, TestId, DateTaken
I would like to return a table showing dates of the LATEST tests passed by each user, e.g.
|--------|---------|---------|---------|---------|---------|
|User |Test A |Test B |Test C |Test D |Test E |
|--------|---------|---------|---------|---------|---------|
|James |Null |6/3/11 |Null |Null |4/3/11 |
|Mark |Null |1/4/11 |8/5/11 |23/5/10 |Null |
|--------|---------|---------|---------|---------|---------|
In this example, James has never passed Tests A, C or D. He may have taken Test B several times, but the latest was on 6/3/11.
I plan to display this data in an ASP.NET GridView. What is the best method for this – can it be done in a SELECT statement? Please help!
Many thanks in advance.
1 Answer