Here is the error SQL statement:
RuntimeError: (sqlite3.OperationalError) near ",": syntax error [SQL: "SELECT stock, SUM(shares) AS shares FROM 'transaction' WHERE userid = 3, stock = 'FB'"]
I'm trying to check if user has enough shares in his portfolio. So need to query the total shares for the specific stock. But I constantly get error on this statement. Is there a way to do this using SQL statement? Or should I query the shares out and sum it out of SQL statement... I have a similar SQL statement for buy() which works fine:
rows = db.execute("SELECT stock, SUM(shares) AS shares FROM 'transaction' WHERE userid=:user_id GROUP BY stock", user_id=session["user_id"])