Here is some sql that may help
Code:
SELECT A.id
,A.studentname
,A.lecturesubject
,A.lecturedate
FROM arian AS A
WHERE (
(
(A.lecturedate) IN (
SELECT TOP 1 b.lectureDate
FROM arian AS B
WHERE b.lecturesubject = a.lecturesubject
AND b.studentname = a.Studentname
ORDER BY b.lecturedate DESC
)
)
)
GROUP BY A.id
,A.studentname
,A.lecturesubject
,A.lecturedate
ORDER BY A.lecturedate ASC
,A.studentname
,A.lecturesubject;
With this result
Code:
id |
studentname |
lecturesubject |
lecturedate |
1 |
john |
mathematics |
02-Mar-12 |
2 |
jack |
chemistry |
10-Mar-12 |
4 |
jack |
chemisty |
20-Mar-12 |
5 |
john |
politics |
30-Mar-12 |
7 |
jack |
politics |
15-Apr-12 |
6 |
john |
engineering |
15-Apr-12 |
NOTE: You have 2 spellings for Chemistry (and Chemisty)
When I correct the spelling, I get this result with the query identified above
Code:
id |
studentname |
lecturesubject |
lecturedate |
1 |
john |
mathematics |
02-Mar-12 |
4 |
jack |
chemistry |
20-Mar-12 |
5 |
john |
politics |
30-Mar-12 |
7 |
jack |
politics |
15-Apr-12 |
6 |
john |
engineering |
15-Apr-12 |
Good luck with your project