Привет, у меня проблемы с вставкой данных в соединительную таблицу.
Мое обновление Query работает хорошо
sql = "UPDATE student_subject " & _
" INNER JOIN subject_bsit " & _
" ON subject_bsit.subject_id = student_subject.sub_id " & _
" SET grade = "1" where student_subject.student_id= "1235" AND student_subject.sub_id = 1"
Это мой оператор SQL при вставке данных в соединительную таблицу, я сделал что-то не так, потому что я получаю синтаксическую ошибку
sql = "INSERT INTO student_subject (student_id,sub_id,grade) " & _
" INNER JOIN student " & _
" ON student.StudentID = student_subject.student_id " & _
" VALUES ("1235","4","1.25")" & _
" where student_subject.student_id= "1235""
То, что я хочу сделать, - это иметь studentID 1235 , чтобы иметь subject_id 4 , который является сетевым.
Это моя таблица базы данных
student Table
-----------------------
|studentID | FullName |
-----------------------
|1234 | John |
|1235 | Michael |
|1236 | Bryce |
"subject_bsit"
-----------------------------------------
|subject_id| subject_name | pre_id |
-----------------------------------------
| 1 | Programming 1 | NULL |
| 2 | Networking | NULL |
| 3 | Algorithm | NULL |
| 4 | Physical Educ | NULL |
| 5 | Programming 2 | 1 |
This is the Junction table to connect the
two now.
"student_subject"
-------------------------------------
| student_id | subject_id | Grade |
-------------------------------------
| 1235 | 1 | NULL |
| 1235 | 2 | 2 |
| 1235 | 3 | 1 |
| 1234 | 1 | 2.25 |