I have a table in which I want to insert data, and the values itself have to come from multiple tables. This has to be done as follows, by reading the MySQL documentation:
insert into flight(airlinecompanyId,planetypeId)
select id from airlinecompany where naam = 'Brussels Airlines',
select id from planeType where type = 'Boeing 737';
So simply explained, I want to insert the id's from the tables airlinecompany and planetype that I demand via the where clausule, into the flight table column.
When I try this query, I keep getting the following 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 from planeType where type = 'Boeing 737'' at line 2
Someone who has a solution?
airlinecomapny, planetype) related? You are inserting two columns -- do the two tables have an exactly identical number of ids?planeTypeandairlinecompanyare not related themselves, are you trying to insert a single row for those two values?