[Zope] ZSQL and last_insert_id

Eric Walstad eric@ericwalstad.com
Tue, 19 Feb 2002 15:11:58 -0800


Hi Chad,
I think you are missing the table name in your SQL statement.
I use something like this:
SELECT CONV(LAST_INSERT_ID(), 10, 10) AS LastId FROM TableName;
I use MySQL's CONV() function to convert the LAST_INSERT_ID to a string 
representation because if I don't, it ends up looking something like 
237L when it comes back from the database.
Hope that helps,
Eric.

Chad Nantais wrote:
> What is the right syntax for getting the id of the last recorded inserted
> with ZSQL methods? I tried this:
> SELECT LAST_INSERT_ID() AS last_insert_id