我有一张表order_product
我想计算成本列和数量列WHERE order_orderNumber = 1100
我该怎么做。?
答案 0 :(得分:1)
如果你的意思是总和,你可以这样做:
SELECT product_id, SUM(quantity) AS totalQuantity, SUM(cost) AS totalCost
FROM order_product WHERE order_orderNumber = 1100
GROUP BY product_id