gpt4 book ai didi

php - 如何对列中包含某些 item_id 的列求和,相应的状态 = 待处理

转载 作者:太空宇宙 更新时间:2023-11-03 10:59:29 25 4
gpt4 key购买 nike

这是我的表格:

id | Prs Id | Amount | Status | Item Id|----------------------------------------1  |   10   |   200  |pending | 5      |2  |   10   |   300  |pending | 7      |3  |   10   |   400  |pending | 9      |4  |   10   |   100  |received| 6      |5  |   10   |   200  |received| 8      |6  |   10   |   300  |received| 3      |7  |   10   |   200  |pending | 5      |8  |   10   |   300  |pending | 7      |9  |   10   |   400  |pending | 9      |10 |   10   |   100  |received| 6      |11 |   10   |   200  |received| 8      |12 |   10   |   300  |received| 3      |

如何从status pending 的特定item_id 中获取总和amount

最佳答案

这里是查询:

select sum(Amount)
from TableName
where Status = 'pending'
and Item_ID = 7

关于php - 如何对列中包含某些 item_id 的列求和,相应的状态 = 待处理,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17056717/

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