1 year ago
#382027
St4rb0y
Set or edit field values of table rows that have a matching other value in Python 3 and sqlite3?
Is there a way in sqlite3 in Python 3 to edit/set the description
of the last two rows of the table animals
here, because they have a matching date?
id | date | animal | description |
---|---|---|---|
0 | 2022-04-01 | bird | domestic canary |
1 | 2022-04-06 | cat | NULL |
2 | 2022-04-06 | dog | NULL |
When I use the following command, nothing really happens:
UPDATE animals SET description='unknown' WHERE description IS NULL AND date=2022-04-06
I guess it finds the 2 rows matching the date, but doesn't know which one to edit.
Is there a simple way to set the description
for both without having to bring the id
, as secondary reference column, into play? id
is the primary keyed column.
Thanks.
sqlite
python-3.9
0 Answers
Your Answer