i have 2 tables. student
and student_records
.
student table has S_id and has foreign key in student_records.
When joining these tables, I need 1 student ID and top 5 records from student_records table for that Student ID.
1 abc 1 dedw .. .. 2 def 2 referf
1
is from Student table and the 'abc','dedw'
etc is from student_records
Also there is an Active field in the student table. If Active=1 then show top 5 records from student_records else if Active=0 the just have 1 row of the studentid