enrique_aeo
asked on
implementation - transact sql - many to many relationship
Hello, What is the implementation?
tblCourse(CourseID, CourseName, CourseField1, CourseField2...)
tblStudent(StudentID, FamilyName, FirstName, DoB, StudentField1, StudentField2...)
tblCourseStudent(CourseID, StudentID, PerformanceMetric1, PerformanceMetric2...)
tblCourse(CourseID, CourseName, CourseField1, CourseField2...)
tblStudent(StudentID, FamilyName, FirstName, DoB, StudentField1, StudentField2...)
tblCourseStudent(CourseID,
ASKER
THE CODE transact sql
enrique_aeo,
Sorry, but it is still not clear.
Patrick
Sorry, but it is still not clear.
Patrick
ASKER
tblCourse(CourseID, CourseName, --) when CourseID is primary key
tblStudent(StudentID, FamilyName, ..) when StudentID is primary key
tblCourseStudent(CourseID, StudentID, ...) when CourseID and StudentID are foreign key
something like I do in transact sql code?
tblStudent(StudentID, FamilyName, ..) when StudentID is primary key
tblCourseStudent(CourseID,
something like I do in transact sql code?
ASKER
my question is, as it resolves a many to many relationship in transact sql code?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
There is no code to form the third table. You should create a form with combo boxes for both Courses and Students as well as some way of entering all the performance metrics (combo or list box)
Try:
SELECT
C.*
,CS.*
,S.*
FROM
tblCourse C
INNER JOIN
tblCourseStudent CS ON C.CourseID = CS.CourseID
INNER JOIN
tblStudent S ON CS.StudentID = CS.StudentID
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
tblCourses and tblStudents are an eschema Intranet, these tables already exist. The new table is tblCoursesStudents, therefore would only have to make the code table creating tblCoursesStudents or I do something extra in the tables tblCourses and tblStudents
Somehow you have to get the info about what students are taking what course into the the tblCoursesStudents. As I suggested earlier, the best way would be to use a form designed for that purpose. You have to create the table and then use the form to populate it.
Thanks, glad to help
>>Hello, What is the implementation?
What is your question? What are you trying to accomplish?
Quick note: that table structure looks denormalized...