I'm finding this issue difficult to solve: I'm trying to use a SQL SELECT statement near a PYTHON VARIABLE , which results in a syntax error. HERE IS MY CODE
item_sql = """
INSERT or REPLACE INTO item(i_name, i_qty)
VALUES
((?), SELECT s_qty + (?) from item)
"""
self.cur.execute(item_sql, (s_item, s_qty))
self.con.commit()
What I am trying to achieve is; after inserting the i_name and i_qty; then in the next insertion, to sum the previous i_qty to the last inserted i qty values.
Is there a way to resolve this conflict of using a SQL SELECT statement near a PYTHON VAR or another way to achieve my desired result.
thanks.