Reputation: 51
How to write sql code insert multiple table but same columns name
------------------- -------------------
| table | | tableTH |
|-----------------| |-----------------|
|id(AI) | |id(AI) |
|name | |name |
|address | |address |
------------------- -------------------
This code not working, How can i do
INSERT INTO table,tableTH (name,address) VALUES ('aaa','bbb');
Upvotes: 0
Views: 136
Reputation: 1622
What about executing 2 statements (possibly inside of a transaction)?:
START TRANSACTION;
INSERT INTO table (name,address) VALUES ('aaa','bbb');
INSERT INTO tableTH (name,address) VALUES ('aaa','bbb');
COMMIT;
Upvotes: 1