View Single Post
  #1 (permalink)  
Old May 4th, 2006, 12:48 PM
jmjyiannis jmjyiannis is offline
Registered User
 
Join Date: Jun 2004
Location: , , .
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default multi-multi-multiple Insert with subquery???

Hello, experts, friends and masters.
I get into the point!

I have a huge (for me) problem.
I have some tables in a database. Lessons, Students, Teachers, Courses and AttendedLessons.
The last table (attendedLessons) has the following collumns:
AttendedLessonID
LessonID,
StudentID,
Mark,
CourseID,
TeacherID.
I want to create an insert query which will take the courseID and the StudentID from the user and it will insert in the AttendedLessons records for all of the Lessons of this specific Course of this specific Student of a selected Teacher.

I have tried this....
insert into AttendedLessons (lessonID,CourseID,StudentID,TeacherID)
(select lessonID,CourseID,StudentID,TeacherID from

(select lessonID, CourseID from Lesson where CourseID='(anything that user gives)'),
(studentID='(anything that user gives)'),
(TeacherID='(anything that user gives)');


but Many different problems occured.

Please...... any suggestion?????

Reply With Quote