0

In sqlite 3 I want to use two "WHERE" statements, here is my code right now

"db.execute("UPDATE portfolio SET shares = :shares WHERE id = :ide",shares = symb[0]["shares"] - number,ide = ide)"

I want to add another where of symbol as this code is changind all shares irrespective of shares, Your help appreciated.#pset7 I also tried this to add symbols in "where" but did not worked.

db.execute("UPDATE portfolio SET shares = :shares WHERE (id,symbol) VALUES (:ide,:smb)",shares = symb[0]["shares"] - number,ide = ide,smb = symbl)

1 Answer 1

2

You can use the AND logic keyword, as below:

UPDATE table SET field1=value1 WHERE field2=value2 AND field3=value3

There is also an OR keyword.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .