Question: I have two tables: `message` and `message_content`:

```
message
id | customer_id | creation_time | msg_headline | status | order_id 

message_content
message_id | msg | creation_time | employee_id

```

When I insert new data I need to create a record in both tables (linked by `id` resp. `message_id`). Is it possible to achieve that using a single statement?

Answer: 
It is not possible to insert into two tables with a single `INSERT` statement. However there are a few options. One of which is using `LAST_INSERT_ID()[1]`:

```
INSERT INTO `message` (`customer_id`, `creation_time`, `msg_headline`, `status`, `order_id`)
  VALUES (...);

INSERT INTO `message_content` (`message_id`, `msg`, `creation_time`, `employee_id`)
  VALUES (LAST_INSERT_ID(), 'message', default, 1)

```

In your actual implementation you should however probably switch to a [prepared statement](http://dev.mysql.com/doc/refman/5.6/en/sql-syntax-prepared-statements.html) (and [PHP: Prepared Statements - Manual](http://php.net/manual/de/mysqli.quickstart.prepared-statements.php), since you originally mentioned PHP).
MySQL doesn't support multi-table insertion in a single INSERT statement. 
If I'm not mistaken, Oracle is the only one I'm aware of that does.

```
INSERT INTO message VALUES(...)
INSERT INTO message_content VALUES(...)

```

However, you can use a transaction and have both of them be contained within one transaction.

```
START TRANSACTION;
INSERT INTO message VALUES ('1','2','3');
INSERT INTO message_content VALUES ('bob','smith');
COMMIT;

```

Font: [INSERT - Documentation MySQL](http://dev.mysql.com/doc/refman/5.1/en/insert.html)

[TRANSACTION - Documentation MySQL](http://dev.mysql.com/doc/refman/5.1/en/commit.html)