assuming that i have two tables, names
and phones
and i want to insert data from some input to the tables, in one query- How can it be done?
Please, if it can be done, explain the syntax.
assuming that i have two tables, names
and phones
and i want to insert data from some input to the tables, in one query- How can it be done?
Please, if it can be done, explain the syntax.
I had the same problem. I solve it with a for loop.
Example:
If I want to write in 2 identical tables, using a loop
either
If you have a small query I don't know if this is the best solution, but if you your query is very big and it is inside a dynamical script with if/else/case conditions this is a good solution.
MySQL doesn't support multi-table insertion in a single INSERT statement. Oracle is the only one I'm aware of that does, oddly...
You can't. However, you CAN use a transaction and have both of them be contained within one transaction.
http://dev.mysql.com/doc/refman/5.1/en/commit.html