Pirun Tirapibal
Pirun Tirapibal

Reputation: 51

Insert multiple table but same columns name

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

Answers (1)

Richard87
Richard87

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

Related Questions