List:General Discussion« Previous MessageNext Message »
From:Gerald Clark Date:April 30 2001 7:33pm
Subject:Re: LAST_INSERT_ID returning 3 rows?
View as plain text  
Because you included a from clause, you got one line for each row
of 'outages'

Leave out the "from outages"

Graeme B. Davis wrote:

> 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 <mysql-thread72724@stripped>
> To unsubscribe, e-mail
> <mysql-unsubscribe-gerald_clark=suppliersystems.com@stripped>
> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php


-- 
Gerald L. Clark
gerald_clark@stripped

Thread
LAST_INSERT_ID returning 3 rows?Graeme B. Davis30 Apr
  • RE: LAST_INSERT_ID returning 3 rows?Braxton Robbason30 Apr
  • Re: LAST_INSERT_ID returning 3 rows?Gerald Clark30 Apr
  • Re: LAST_INSERT_ID returning 3 rows?Graeme B. Davis1 May
    • Re: LAST_INSERT_ID returning 3 rows?Alexander Skwar4 May
Re: LAST_INSERT_ID returning 3 rows?Graeme B. Davis1 May
Re: LAST_INSERT_ID returning 3 rows?alec.cawley2 May