mysql函数-LAST_INSERT_ID
With no argument, LAST_INSERT_ID() returns a BIGINT UNSIGNED (64-bit) value representing the first automatically generated value successfully inserted for an AUTO_INCREMENT column as a result of the most recently executed INSERT statement.
mysql> INSERT INTO `test_user`.`product` (`id`, `amount`) VALUES (NULL, '5');
Query OK, 1 row affected
mysql> select LAST_INSERT_ID();
+------------------+
| LAST_INSERT_ID() |
+------------------+
| 6 |
+------------------+
1 row in set
mysql> INSERT INTO `test_user`.`product` (`id`, `amount`) VALUES (NULL, '7'),(null, '8'),(null,'9');
Query OK, 3 rows affected
Records: 3 Duplicates: 0 Warnings: 0
mysql> select LAST_INSERT_ID();
+------------------+
| LAST_INSERT_ID() |
+------------------+
| 7 |
+------------------+
1 row in set
结论:以第二各种形式插入多条数据,LAST_INSERT_ID
只返回自增一次的结果