last_insert_id is a function. It will return a value for each row in the
table. You want to run:
select last_insert_id() as lid;
instead of selecting from a table.
-----Original Message-----
From: Graeme B. Davis [mailto:[EMAIL PROTECTED]]
Sent: Monday, April 30, 2001 3:17 PM
To: [EMAIL PROTECTED]
Subject: LAST_INSERT_ID returning 3 rows?
mysql> INSERT INTO outages (status) VALUES ('Open');
mysql> SELECT LAST_INSERT_ID() AS lid FROM outages;
+-----+
| lid |
+-----+
| 101 |
| 101 |
| 101 |
+-----+
3 rows in set (0.00 sec)
Why would MYSQL do this? Any ideas?
Thanks,
Graeme
p.s. DESCRIBE outages;
+---------------+------------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+---------------+------------------+------+-----+---------+----------------+
| id | int(10) unsigned | | PRI | NULL | auto_increment |
| router | varchar(25) | YES | | NULL | |
| techticket | varchar(15) | YES | | NULL | |
| rfoticket | varchar(15) | YES | | NULL | |
| nocticket | varchar(15) | YES | | NULL | |
| sitesaffected | int(6) | YES | | NULL | |
| telconame | varchar(100) | YES | | NULL | |
| telcoticket | varchar(100) | YES | | NULL | |
| start | datetime | YES | | NULL | |
| stop | datetime | YES | | NULL | |
| updated | timestamp(14) | YES | | NULL | |
| slasent | datetime | YES | | NULL | |
| sla | varchar(10) | YES | | NULL | |
| vmstart | datetime | YES | | NULL | |
| vmstop | datetime | YES | | NULL | |
| rfo | varchar(200) | YES | | NULL | |
| status | varchar(15) | | | Open | |
| interface | varchar(255) | YES | | NULL | |
| comments | text | YES | | NULL | |
+---------------+------------------+------+-----+---------+----------------+
---------------------------------------------------------------------
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)
To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail
<[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
---------------------------------------------------------------------
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)
To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php