You don't need the VALUES keyword, as you are selecting from a query: INSERT INTO trivia_data ( So please try to explain as simply as possible. INSERT INTO trivia_data VALUES(q_id, q_text, q_options_1, q_options_2, q_options_3, q_options_4, q_options, q_difficulty_level, q_date_added) SELECT question_info.q_id, question_info.q_text, question_options_info.q_options_1, question_options_info.q_options_2, question_options_info.q_options_3, question_options_info.q_options_4, question_answer_info.q_options, question_info.q_difficulty_level, question_info.q_date_added FROM question_info JOIN question_options_info on question_info.q_options_id = question_options_info.q_options_id JOIN question_answer_info on question_info.q_id = question_answer_info.q_id I have already tried this specific query to insert the data: This query would return data somewhat like this: SELECT question_info.q_id, question_info.q_text, question_options_info.q_options_1, question_options_info.q_options_2, question_options_info.q_options_3, question_options_info.q_options_4, question_answer_info.q_options, question_info.q_difficulty_level, question_info.q_date_addedįROM question_info JOIN question_options_info ON question_info.q_options_id = question_options_info.q_options_id JOIN question_answer_info ON question_info.q_id = question_answer_info.q_id So what I need is to, insert a data into trivia_data table. Q_options_ex_4 varchar(1024) DEFAULT NULL, Q_options_ex_3 varchar(1024) DEFAULT NULL, Q_options_ex_2 varchar(1024) DEFAULT NULL, Q_options_ex_1 varchar(1024) DEFAULT NULL, Q_difficulty_level tinyint(4) NOT NULL DEFAULT '0', So the scenario here is, I have 4 tables in the database namely:
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |