psycoperl
Active Member
- Joined
- Oct 23, 2007
- Messages
- 339
- Office Version
- 365
- 2016
- Platform
- Windows
- MacOS
- Web
I am trying to use the following query to get the most recent comment record for a student. I am expecting either 0 or 1 records, however when I am running it I am sometimes getting more than one.
SELECT Max(CommentDate) AS MaxDate,
ReceivedOnATBEligible, NotATBeligible
FROM tblComments
GROUP BY StudentID, ReceivedOnATBEligible, NotATBeligible
HAVING (((StudentID)="000000000'));
Can anyone please advise?
Thanks
tblComments:
ATBCommentsID StudentID CommentDate ReturnedToSender Comment ReceivedOnATBEligible NotATBeligible
1 000000000 6/30/2011 1:50:55 PM True Test Record False True
2 000000000 6/30/2011 2:41:14 PM False True False
4 000000000 6/30/2011 2:41:41 PM False False True
SELECT Max(CommentDate) AS MaxDate,
ReceivedOnATBEligible, NotATBeligible
FROM tblComments
GROUP BY StudentID, ReceivedOnATBEligible, NotATBeligible
HAVING (((StudentID)="000000000'));
Can anyone please advise?
Thanks
tblComments:
ATBCommentsID StudentID CommentDate ReturnedToSender Comment ReceivedOnATBEligible NotATBeligible
1 000000000 6/30/2011 1:50:55 PM True Test Record False True
2 000000000 6/30/2011 2:41:14 PM False True False
4 000000000 6/30/2011 2:41:41 PM False False True