我需要最后一列的利润,购买价格和第四列价格的总和,我尝试了一些事情组的股票id等,但它没有给我相同的答案。请告诉我如何计算他们的总数。
SELECT
jobc_consumble.Stock_id,
jobc_consumble.issued_qty,
jobc_consumble.total,
p_purch_stock.Price,
p_purch_stock.Price * jobc_consumble.issued_qty AS "purch_price",
jobc_consumble.total -(SELECT purch_price) AS "profit"
FROM
jobc_consumble
INNER JOIN p_purch_stock ON jobc_consumble.stock_id = p_purch_stock.stock_id
WHERE
DATE_FORMAT(
jobc_consumble.issue_time,
'%Y-%m-%d'
) BETWEEN '2018-07-03' AND '2018-07-03'
输出:在此处输入图像描述
我需要的是:
利润总额:1105
采购总价:11000
暂无答案!
目前还没有任何答案,快来回答吧!