Hello All!
I have to insert mutiple rows into 5 tables. Basically, I am trying to copy the previous year's entries into the same tables with a new year. Is this possible? (Doing and insert with inner joins)
INSERT INTO a.module_title, a.module_desc, a.module_instructor, a.module_schlyr, b.lesson_title, b.lesson_text, b.lesson_schlyr, c.question_desc, c.question_schlyr, d.answer_text, d.answer_schlyr, e.instruction_text, e.instruction_schlyr
SELECT a.module_title, a.module_desc, a.module_instructor, '2009', b.lesson_title, b.lesson_text, '2009', c.question_desc, '2009', d.answer_text, '2009', e.instruction_text, '2009'
FROM module as a INNER JOIN lessons as b ON a.module_id=b.lesson_mod_id INNER JOIN questions AS c ON b.lesson_id = c.question_lesson_id INNER JOIN instructions AS e ON e.question_instruction_id = c.question_id INNER JOIN answers AS d ON c.question_id = d.answer_quest_id WHERE a.module_id = '132'AND a.module_schlyr = '2008'
I keep getting an error of:
Server: Msg 170, Level 15, State 1, Line 1
Line 1: Incorrect syntax near ','.
I know this is probably as clear as mud! Please help, if you can!
Lladros
I have to insert mutiple rows into 5 tables. Basically, I am trying to copy the previous year's entries into the same tables with a new year. Is this possible? (Doing and insert with inner joins)
INSERT INTO a.module_title, a.module_desc, a.module_instructor, a.module_schlyr, b.lesson_title, b.lesson_text, b.lesson_schlyr, c.question_desc, c.question_schlyr, d.answer_text, d.answer_schlyr, e.instruction_text, e.instruction_schlyr
SELECT a.module_title, a.module_desc, a.module_instructor, '2009', b.lesson_title, b.lesson_text, '2009', c.question_desc, '2009', d.answer_text, '2009', e.instruction_text, '2009'
FROM module as a INNER JOIN lessons as b ON a.module_id=b.lesson_mod_id INNER JOIN questions AS c ON b.lesson_id = c.question_lesson_id INNER JOIN instructions AS e ON e.question_instruction_id = c.question_id INNER JOIN answers AS d ON c.question_id = d.answer_quest_id WHERE a.module_id = '132'AND a.module_schlyr = '2008'
I keep getting an error of:
Server: Msg 170, Level 15, State 1, Line 1
Line 1: Incorrect syntax near ','.
I know this is probably as clear as mud! Please help, if you can!
Lladros