LAST_INSERT_ID( ) returning multiple rows of 0?

后端 未结 5 758
独厮守ぢ
独厮守ぢ 2020-12-17 06:17

Working in phpMyAdmin for now:

order table strucure:

OrderID     int(11)  auto_increment
CustomerID  varchar(50)
BillAddr    varchar(200         


        
5条回答
  •  长情又很酷
    2020-12-17 07:00

    As stated in the manual:

    LAST_INSERT_ID() (with no argument) returns a BIGINT (64-bit) value representing the first automatically generated value that was set for an AUTO_INCREMENT column by the most recently executed INSERT statement to affect such a column. For example, after inserting a row that generates an AUTO_INCREMENT value, you can get the value like this:

    mysql> SELECT LAST_INSERT_ID();
            -> 195

提交回复
热议问题