How to select last inserted record from Table Using Database.HSQL.MySQL

Hi, everyone! trycon <- connect "mysql" "bigtables" "vasya" "*******" stmt' <- query trycon "INSERT INTO mytable (user,time,host,) VALUES ("Vasya","2011.07.30 11.59","foo")" I am beginner to use HSQL and I have a problem. I need to know row ID after INSERT into table. fetch stmt' returned False What should I do? Cheers!

Hello Sergiy, On 07/25/2011 04:54 PM, Sergiy Nazarenko wrote:
Hi, everyone!
trycon <- connect "mysql" "bigtables" "vasya" "*******" stmt' <- query trycon "INSERT INTO mytable (user,time,host,) VALUES ("Vasya","2011.07.30 11.59","foo")"
I am beginner to use HSQL and I have a problem. I need to know row ID after INSERT into table.
fetch stmt' returned False
What should I do?
This does not seem to be HSQL specific. For mysql, Google gave me LAST_INSERT_ID(): http://dev.mysql.com/doc/refman/5.0/en/information-functions.html#function_l... There probably exist similar functions for other sql databases. -- Steffen
participants (2)
-
Sergiy Nazarenko
-
Steffen Schuldenzucker