Feb-12-2019, 09:32 AM
Hello,
I'm trying to calculate the total of a column of values using an sQL DB.
The values are generated using a query.
I have an Orders table: within that the 'Quantity' column is multiplied by the 'Price' column to create a 'Totals' column. I am joining 2 tables to gain the values.
Therefore, when I use the SELECT SUM(Totals) command it tells me that there is no column called Totals.
My query is as follows:
Therefore, it is 'Total' I need to calculate.
Further to this, can I display this new value using the same 'Tree' 'Frame' that I am using to display this query?
I really hope this can be done, obviously I'll be very grateful for any suggestions or alternatives.
Many thanks in advance,
Dewi :)
I'm trying to calculate the total of a column of values using an sQL DB.
The values are generated using a query.
I have an Orders table: within that the 'Quantity' column is multiplied by the 'Price' column to create a 'Totals' column. I am joining 2 tables to gain the values.
Therefore, when I use the SELECT SUM(Totals) command it tells me that there is no column called Totals.
My query is as follows:
1 2 3 4 5 |
c = myshop_db.execute( '''SELECT Orders.Cust_Num, Orders.Order_Date, Orders.Prod_Num, Products.Prod_Name, Orders.Prod_Qty, Products.Prod_Cost, Orders.Prod_Qty * Products.Prod_Cost as Total FROM Orders INNER JOIN Products ON Orders.Prod_Num = Products.Prod_Num WHERE Orders.Order_Num = ?''' , num) |
Further to this, can I display this new value using the same 'Tree' 'Frame' that I am using to display this query?
I really hope this can be done, obviously I'll be very grateful for any suggestions or alternatives.
Many thanks in advance,
Dewi :)