mysql-python: How can I retrieve the ID of the last record I added?

Gabriel Ambuehl gabriel_ambuehl at buz.ch
Fri Sep 28 10:48:24 EDT 2001


-----BEGIN PGP SIGNED MESSAGE-----

Hello Oleg,

Friday, September 28, 2001, 3:44:40 PM, you wrote:

>> good, but how can I fetch the id of the last record added? I know
>> I can do some SELECT to gather the ID but if there are two
>> completely identical records, which is possible, it won't do me
>> any good. So is there some library function to reliably retrieve
>> the id of the last record I inserted into the table?
>    SELECT LAST_INSERT_ID()

Thanks a lot.



Best regards,
 Gabriel

-----BEGIN PGP SIGNATURE-----
Version: PGP 6.5i

iQEVAwUBO7R/rMZa2WpymlDxAQGYlgf/ZPf2tsWd6OATP64PZa6reX3Fw91IcinE
lmWs11RHx2C8WAPeUFd5MFTk/2aIz0Jl4ofskujO5WJ5ReLmWYATvFyad7cd9oBd
oBFFVcB5/ZYti59RBaVz8AyQc088OersoEc0UHOBeYixGnUxG+PqBl/Vglhu3Fsv
o5yrI5ipQUvTpOBorGxOBTfy36D45F+89n08PpCFUNT/Metgp1vqssFx4RAClIfg
yeAD1wi9+4FMXDFqjL1UmVct5z6cIm0r6XxSz7tLhspGpcCjSlOIXtAb+R1AZPoI
euHI1HCD4k4F+nSBgNap+GQusJjrGt8W1hENmyA8PrS03dlwiSfulw==
=3DLC
-----END PGP SIGNATURE-----





More information about the Python-list mailing list