我有 3 张桌子
sales
-----------
date
order_id
product_details
-----------
product_id
cost
price
order_detail
-----------
product_id
order_id
我必须减去日期在__和__之间的成本和价格的总和以显示盈亏
我已经尝试过了,但没有显示出什么结果
SELECT ( SUM(p.price) - SUM(p.cost) )
FROM product_details AS p
LEFT JOIN order_detail AS o
ON o.product_id = p.product_id
JOIN sales AS s
ON s.order_id = o.order_id
WHERE s.[date] = ' 15.08.2013'