Yeah Baz... you could try adding the "from address" to the select @@identity or last_insert_id() I pointed out earlier as well. But it should assume that. Both work fine for me on MySQL5 without the 'from tablename'. ..:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:. Bobby Hartsfield http://acoderslife.com
-----Original Message----- From: Andy Matthews [mailto:[EMAIL PROTECTED] Sent: Monday, January 09, 2006 10:42 AM To: CF-Talk Subject: RE: Get last inserted ID mySQL has the LAST_INSERT_ID() function. I do this: SELECT LAST_INSERT_ID() as id FROM yourTableName <!----------------//------ andy matthews web developer ICGLink, Inc. [EMAIL PROTECTED] 615.370.1530 x737 --------------//---------> -----Original Message----- From: Baz [mailto:[EMAIL PROTECTED] Sent: Sunday, January 08, 2006 6:24 PM To: CF-Talk Subject: Get last inserted ID Is this the best way to do this: <cftransaction> <cfquery name="InsertAddress" datasource="#DSN#"> INSERT INTO Address (City) VALUES (<cfqueryparam value="#City#" cfsqltype="cf_sql_integer" />) </cfquery> <cfquery name="getInsertedID" datasource="#DSN#"> SELECT MAX(AddressID) as MaxID FROM Address </cfquery> </cftransaction> I'm using MySQL. Cheers, Baz ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Message: http://www.houseoffusion.com/lists.cfm/link=i:4:228848 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4 Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

