Having problems  with a select query:

SELECT MAX(QuizDate) as QuizDate, QuizID
FROM Test_Board_Biomed
WHERE Customer_ID = 21
GROUP BY QuizID

The above query returns:

QuizDate    QuizID
2004-10-12 Antacids  
2004-10-13 Sleep
2004-10-12 Stool

What I want is something like

QuizDate    QuizID     QuizPercent
2004-10-12  Antacids    53  
2004-10-13  Sleep       62
2004-10-12  Stool       61

I am having a hard time selecting the QuizPercent associated with
the Max(QuizDate). Basicaly, I want to extract the Score that was
received on the last date the test was taken.

SELECT MAX(QuizDate) as QuizDate, QuizID, QuizPercent
FROM Test_Board_Biomed
WHERE Customer_ID = 21
GROUP BY QuizID , QuizPercent

The above query returns

QuizDate    QuizID      QuizPercent
2004-10-11 Sleep      25
2004-10-11 Sleep      37
2004-10-11 Antacids   46
2004-10-12 Antacids 53
2004-10-12 Stool          61
2004-10-13 Sleep          62
2004-10-12 Sleep          75
2004-10-12 Sleep          87
2004-10-12 Sleep         100

What am I doing wrong? Or is it that it's not possible to have
this kind of query?

Sebastian
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]

Reply via email to