函数last_insert_id返回0

时间:2014-04-22 09:15:45

标签: mysql

我有承诺:

 mysql> CREATE TABLE auto(id int AUTO_INCREMENT PRIMARY KEY,num int);
    Query OK, 0 rows affected (1.40 sec)

    mysql> INSERT INTO auto VALUES(1,1);
    Query OK, 1 row affected (0.51 sec)

    mysql> SELECT LAST_INSERT_ID() FROM auto;
    +------------------+
    | LAST_INSERT_ID() |
    +------------------+
    |                0 |

为什么返回0?

0 个答案:

没有答案