gpt4 book ai didi

Mysql - 对我的业务逻辑有一点帮助

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

我在网上商店中有一个产品表(idstockavailability,....),到目前为止我的业务逻辑是:

产品在以下情况下可用:

  • 如果库存情况=0 且库存>0
  • 如果库存情况 >0 并且库存 >=0

我使用可用性来通知客户购买后发货的天数,并且我设置可用性= 0来确定该产品仅在库存> 0时可用。这样,当我设置可用性= 0 且stock=0,产品将因此变得不可用。

我不确定是否

select * from product where (availability=0 and stock>0) or (availability>0 and stock>=0)

会起作用,这看起来很简单,但确实如此。有什么想法吗?

最佳答案

根据您的情况使用此:

select *from products where availability>=0 and stock>0

关于Mysql - 对我的业务逻辑有一点帮助,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10502127/

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