2011/1/21 Jerry Schwartz <[email protected]>:
>>-----Original Message-----
>>From: João Cândido de Souza Neto [mailto:[email protected]]
>>Sent: Friday, January 21, 2011 12:47 PM
>>To: [email protected]
>>Subject: Re: CURRENT insert ID
>>
>>Ok, you must have your own reasons to do that.
>>
>>The fact is: You can´t set the auto_incremente value field to another field
>>in the same table and record even in a trigger.
>>
>>So, the best way is a second update.
>>
> [JS] That's what I'm trying to do now, but I'm using MS Access through an ODBC
> connection and I haven't figured out how to retrieve last_insert_id.
I will tell you a secret. But shhhhhhhhhh. Do not tell anyone:
------8<------8<------8<------8<------8<------8<------8<------8<------8<------8<------8<------
mysql> create table mytable(id int auto_increment primary key, name
varchar(255));
Query OK, 0 rows affected (0.07 sec)
mysql> insert into mytable (name) values ('test data');
Query OK, 1 row affected (0.00 sec)
mysql> select id from mytable where id is null; -- OMG!!!
+----+
| id |
+----+
| 1 |
+----+
1 row in set (0.00 sec)
------8<------8<------8<------8<------8<------8<------8<------8<------8<------8<------8<------
--
Jaime Crespo
MySQL & Java Instructor
Software Developer
Warp Networks
<http://warp.es>
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/[email protected]