I am stuck here, I have to display sum of each share of specific share group by symbol I have tried a lot but could not get it how can I display them in the html.This is my index.py code right now, I am using loop to display each symbol separately.
I think I know what you are after. You could try your SQL as something like this:
SELECT stocks, price, SUM(shares) as total_shares, SUM(shares) * price AS total FROM porfolio WHERE user_id = ii GROUP BY stock ORDER BY stock
I tested this so it should work.
I removed you " * " when making the SELECT statement because the 'shares' columns would contradict the new 'total_shares' column.
Let me know if you need clarification on my code.