skip to Main Content

Phpmyadmin – why multiply two column in sql is not equals to sum(column1 * column2)

if have these tables : orders(amount,unit_price,child_amount,child_price,service_id,issue_date,is_success) pools(name,for_view) services(id,pool_id) when i run this sql : SELECT SUM(orders.amount) AS totalAmount, SUM(orders.unit_price) AS totalPrice, SUM(orders.amount*orders.unit_price) AS total, SUM(orders.child_amount) AS totalAmountC, SUM(orders.child_price) AS totalPriceC, SUM(orders.child_amount*orders.child_price) AS totalC, pools.name, pools.for_view FROM orders INNER JOIN services…

VIEW QUESTION

Laravel eloquent GROUP BY

I have four tables: supplies, stocks, stock_ins, and stock_outs. In the Stock controller, I want to sum the total stock_out for each supply . For this, I have used the following query: $supplies = Stock::select( 'supplies.name', 'stocks.supply_id', 'stocks.id', 'stocks.stock', 'stock_ins.quantity…

VIEW QUESTION
Back To Top
Search