I'm trying to understand a function that could help me in the SELL part of the pset7, but so far, I'm failing...
I want to select from my database every shares own by the user, grouping them by name while adding them. My request looks like this :
total_stock = db.execute("SELECT *, SUM(nb_of_shares) FROM portfolio WHERE username = :username AND stock_symbol = :stock_symbol", username = user["username"], stock_symbol = stock_to_sell)
By passing this order onto phpLite, I can see that it casts a result, one line including a new row SUM(nb_of_shares)
From this, I would like to get the result of it as an integer, thing that I thought could work like this :
but it seems to be of a NoneType. I tried a lot of other options but none of them worked. Any idea if this is possible? Thanks in advance!