2

Possible Duplicate:
Mysql mulitple row insert-select statement with last_insert_id()

Is there a possibility to get the last_inserted_ids ?

mysql> CREATE TABLE employee (
    ->      id MEDIUMINT NOT NULL AUTO_INCREMENT,
    ->      name CHAR(30) NOT NULL,
    ->      PRIMARY KEY (id)
    ->  );
Query OK, 0 rows affected (0.01 sec)

mysql>
mysql> INSERT INTO employee (name) VALUES ('A'),
    ->                                    ('B'),
    ->                                    ('C'),
    ->                                    ('D'),
    ->                                    ('E'),
    ->                                    ('F');

Now how can I get the ids of 'A', 'B', 'C' ... ? Does MySQL offer me a simple way to do this ? like it does with one row

SELECT LAST_INSERT_ID();
Community
  • 1
  • 1
justSaid
  • 1,540
  • 2
  • 12
  • 23

0 Answers0