I created an Update query for two tables with INNER JOIN and its working fine. The code is below.
table 1 = circuiti , table 2 = clienti
UPDATE circuiti INNER JOIN clienti ON circuiti.Cod =
clienti.Cod_ SET es = ?,
test = ?, type = ?, Note =?
WHERE circuiti.id= ?"
But i want to implement same as this in INSERT query like creating a new record through INNER JOINT of tables. thank you.
MySQL does not support the insertion of data into multiple tables in a single sql command. As MySQL documentation on insert statement says:
tbl_name is the table into which rows should be inserted.
You need to issue 2 insert statements after each other. If you include the 2 inserts into a single transaction, then you can commit or rollback both statements as a single unit.
However, if you want to insert into a single table based on values from multiple tables, that can be achieved through an insert ... select ... statement, where the select part would have the join of the 2 tables.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.