i am trying this query but didn’t work.
ERROR: #1064 – You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘= (SELECT id_university FROM university WHERE university = "xxx") , `singl’ at line 2
INSERT INTO `database_charts`.`university_has_single_user` (
`university_id_university` = (SELECT id_university FROM university WHERE university = "xxx") ,
`single_user_users_id_user` = (SELECT users_id_user FROM single_user WHERE users_id_user = "1" ),
`course_id_course`= (SELECT id_course FROM course WHERE course = "yyy"),
`year`= "2000" )
How can this be solved?
Unless MySQL supports a very strange syntax, that’s not how you write an INSERT statement. It takes this form:
So you would have
Caveat: I’m not sure whether MySQL will actually handle a nested SELECT for each column value, but the above is how INSERT statements are typically written.