I think an ON INSERT TRIGGER would take care of this; can't think of any other way. Â Using last_insert_id() in the argument list would likely yield you the previous value (which might not even related to your table.
Having siad that..  odd requirement.  - michael dykman ps -- sorry for the duplicate Jerry, reply-to policy on this list is forever tripping me up. > > On Fri, Jan 21, 2011 at 11:41 AM, Jerry Schwartz <je...@gii.co.jp> wrote: >> Here it is in a nutshell: >> >> >> >> I have a field that needs to be set equal to the auto-increment ID as a >> record is entered. I don’t know how to do this without a subsequent UPDATE >> (which I can do with a trigger). Is there any way to avoid the cost of an >> UPDATE? >> >> >> >> Here’s a more concrete description of the problem: >> >> >> >> CREATE TABLE t ( >> >> id INT(11) AUTO-INCREMENT PRIMARY, >> >> xxx INT(11) >> >> ); >> >> >> >> When a record is added to table `t`, I need to set `xxx` to the value >> generated for `id`. (`xxx` might be changed later.) >> >> >> >> Is there anything clever I can do? >> >> >> >> Regards, >> >> >> >> Jerry Schwartz >> >> Global Information Incorporated >> >> 195 Farmington Ave. >> >> Farmington, CT 06032 >> >> >> >> 860.674.8796 / FAX: 860.674.8341 >> >> E-mail:  <mailto:je...@gii.co.jp> je...@gii.co.jp >> >> Web site:  <http://www.the-infoshop.com/> www.the-infoshop.com >> >> >> >> > > > > -- >  - michael dykman >  - mdyk...@gmail.com > >  May the Source be with you. > --  - michael dykman  - mdyk...@gmail.com  May the Source be with you. -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/mysql?unsub=arch...@jab.org