List:MySQL on Win32« Previous MessageNext Message »
From:Paul DuBois Date:October 27 1999 5:04pm
Subject:Re: last_insert_id()
View as plain text  
At 12:06 PM -0400 10/27/99, Peter Bojkov wrote:
>I have a table with approx. 10 mln. rows. I am trying to do a
>"select last_insert_id() from table" and mysql returns me 10 mln.
>rows filled with zeroes. Is that a normal behavior? There isn't much
>info about that function in the mysql manual, neither in the O'Reilly's
>book about mysql&msql.

Since you have specified no WHERE clause in your query, MySQL will return
a result set with one row per row in your table.  The value of last_insert_id()
will be 0 if you have not inserted a record into a table with an AUTO_INCREMENT
column at some point in the same server session.

What exactly are you trying to do?

Paul DuBois, paul@stripped
Framework 2 and Win64Larry Lowry31 May
  • Re: last_insert_id()Vivek Khera27 Oct
  • Re: last_insert_id()Tim Endres27 Oct
  • Re: last_insert_id()Name Removed27 Oct
  • Re: last_insert_id()Paul DuBois27 Oct
  • Re: last_insert_id()sinisa27 Oct
  • Re: last_insert_id()Name Removed27 Oct
  • Re: Framework 2 and Win64Da Programmer2 Jun