Suppose I have a table MyTable where the primary key is ID and a composite unique key is ColA and ColB.
I want to retrieve the ID affected by an UPDATE statement like this:
UPDATE MyTable
SET ColC='Blah'
WHERE ColA='xxx' and ColB='yyy'
Is there any way to do this using sqlite3 in python3 in a single statement without doing another SELECT after a successful UPDATE? I'm aware of lastrowid attribute on a cursor, but it seems to only apply to INSERTs.
More generally, I'm curious if any SQL engine allows for such functionality.
Aucun commentaire:
Enregistrer un commentaire