Question: I have one table with 2 columns that i essentially want to split into 2 tables:

table A columns: user\_id, col1, col2

New tables:

B: user\_id, col1

C: user\_id, col2

I want to do:

```
INSERT INTO B (user_id, col1) SELECT user_id,col1 from A;
INSERT INTO C (user_id,col2) SELECT user_id, col2 from A;

```

But i want to do it in one statement. The table is big, so i just want to do it in one pass. Is there a way to do this?

Thx.

Answer: 
No, you can't insert into more than one table at the same time. `INSERT` syntax allows only a single table name.

<http://dev.mysql.com/doc/refman/5.5/en/insert.html>

> 
> INSERT [LOW\_PRIORITY | DELAYED |
>  HIGH\_PRIORITY] [IGNORE] [INTO]
>  **tbl\_name** [...
> 
> 
>
Write a stored procedure to encapsulate the two inserts and protect the transaction.