join tables with foreign key

Posts   
 
    
marsattack
User
Posts: 2
Joined: 29-May-2007
# Posted on: 29-May-2007 15:38:24   

LLBL version = v2

I have 4 tables: 1. teacher table 2. student table 3. course table 4. teacher_student table which defines many-to-many relationship of teacher and student.

So, student can have many teacher and vice versa. teacher has relation with 1 course only and courseID defines as foreign key in teacher table.

I want to show collection of students who follow specific course. can you help me solve this problem.

column inside all tables: - course table: courseID, courseName - teacher table: teacherID, teacherName, courseID - teacher_student table: teacherID, studentID - student table: studentID, studentName

thanks...

marsattack
User
Posts: 2
Joined: 29-May-2007
# Posted on: 29-May-2007 15:40:02   

oh ya I forgot to mention that I want to show it inside grid.

jbb avatar
jbb
User
Posts: 267
Joined: 29-Nov-2005
# Posted on: 29-May-2007 15:40:43   

Hello,

do you use the adapter or self service?

Walaa avatar
Walaa
Support Team
Posts: 14995
Joined: 21-Aug-2005
# Posted on: 30-May-2007 11:01:06   

I want to show collection of students who follow specific course. can you help me solve this problem.

column inside all tables: - course table: courseID, courseName - teacher table: teacherID, teacherName, courseID - teacher_student table: teacherID, studentID - student table: studentID, studentName

I think you are asking about how to do the query, right?

Just fetch an EntityCollection of Students, using a filter of TeacherFields.CourseID = xx. Also you should specify the a relationCollection (for the JOINS) from Student -> TeacherStudent -> Teacher.