From: Ed Carp Date: March 16 1999 11:32pm Subject: Re: Can I get a field when inserting a row? List-Archive: http://lists.mysql.com/mysql/355 Message-Id: <004901be7005$4758c560$74c9a8c0@traveler.airmail.net> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit >> The last insert id is stored *per thread*, not per table. When >> you select LAST_INSERT_ID(), it checks your thread for the most >> recent ID inserted. This is critical for correct performance of >> programs, because more than one thread can be updating a table. >> If LAST_INSERT_ID() returned the most recent ID for a table, you >> could not be sure it belonged to the row you just inserted or a >> row that someone else inserted. You could also add a timestamp field to the table, then do "select ID from table order by timestamp_field desc limit 1", then suck off the ID that way, but again, that's not a guarantee, due to the concurrent threads issue. Maybe if you explain exactly *why* you want to get the ID of the last row, we might be able to assist you better?