Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
我认为您不需要案例语句,一切都可以在一个查询中具有某种逻辑:
SELECT * FROM product_variants WHERE discount_price >= 60 OR (discount_price <= 0 AND price >= 60)
假设discod_price不能为负,第二个条件可以是(discount_price = 0 and Price&gt; = 60)。
discod_price
(discount_price = 0 and Price&gt; = 60)
编辑:AS @tim biegeleisen 说明,(discount_price&gt; 0 and distib_price&gt; = 60)修复了。
I think you don't need a case statement, everything could be in one query with some logic:
Assuming discount_price cannot be negative, the second condition can be (discount_price = 0 AND price >= 60).
discount_price
(discount_price = 0 AND price >= 60)
EDIT: As @Tim Biegeleisen stated, (discount_price > 0 AND discount_price >= 60) has no sense, fixed that.
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
暂无简介
文章 0 评论 0
接受
发布评论
评论(1)
我认为您不需要案例语句,一切都可以在一个查询中具有某种逻辑:
假设
discod_price
不能为负,第二个条件可以是(discount_price = 0 and Price&gt; = 60)
。编辑:AS @tim biegeleisen 说明,(discount_price&gt; 0 and distib_price&gt; = 60)修复了。
I think you don't need a case statement, everything could be in one query with some logic:
Assuming
discount_price
cannot be negative, the second condition can be(discount_price = 0 AND price >= 60)
.EDIT: As @Tim Biegeleisen stated, (discount_price > 0 AND discount_price >= 60) has no sense, fixed that.