I have two tables for storing student data for the classroom:
Behavior_Log has columns student_id, comments, date Student_Roster has columns student_id, firstname, lastname
The database is used to store daily comments about student behavior, and sometimes the teacher makes several comments about the student on a particular day.
Now let's say that the teacher wants to get a list of the last 3 comments made for EVERY student, for example:
Discussion Jessica 7/1/09
Jessica 7/1/09 skips notes
Jessica 5/3/09 is missing
Ciboney 7/2/09 is a lot of participation
Ciboney 4/30/09 is missing
Ciboney 2/22/09 is a lot of participation ... and t .d. for the whole class
A single SQL query should return a set of comments for each student to eliminate the person’s need for intensive consumption for the teacher to run separate queries for each student in the class.
I know that this is similar
to SQL statement help - select the last order for each customer , but I need to display the last 3 records for each person, I can’t figure out how to get from here to
Thanks for your suggestions!
source
share