gpt4 book ai didi

php - 计算列中的所有值

转载 作者:行者123 更新时间:2023-11-29 14:40:26 25 4
gpt4 key购买 nike

我有一个表 order_product

enter image description here

我想计算成本列和数量列中的所有值,其中order_orderNumber = 1100

我该怎么做?

最佳答案

如果你指的是总和,你可以这样做:

SELECT product_id, SUM(quantity) AS totalQuantity, SUM(cost) AS totalCost
FROM order_product WHERE order_orderNumber = 1100
GROUP BY product_id

关于php - 计算列中的所有值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8105869/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com