On Tue, 2005-02-15 at 17:56, steve cooley wrote:
> How do you you get the next auto increment value?  I think I'm running 
> into the insert...select problem.  I want to duplicate records from one 
> table to the _same_ table, with an incremented auto increment value.
> 
> Can I do something like this:
> 
> insert into table (autoincrement_key, field1, field2) select 
> (get_autoincrement(),field1,field2) from table where autoincrement_key 
> = "31337"
> 
> Not so far as I can tell.  Unless I'm just not seeing it in the 
> documentation.  Is there a function to return the next autoincrement 
> value?
> 
> -steve

I don't think you can anticipate the value but, if I under stand you
correctly, this aught to work (I assume you got 31337 from
last_insert_id():

insert into table (field1, field2) select 
        (field1,field2) from table where autoincrement_key = "31337"

-- 
 - michael dykman
 - [EMAIL PROTECTED]


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to