gpt4 book ai didi

MySQL IF ELSE 真假

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

SELECT IF(price == null, 0, price) FROM trips 
WHERE id=9 and prices LIKE "%|s|1|%" and prices LIKE "%|ss|24|%"

如果LIKE "%|ss|2|%"执行该价格,如果有LIKE "%|ss|24|%" 不执行任何操作表明您有使其0

最佳答案

没有显示任何内容,因为没有包含“|s|1|”的价格值和“|ss|24|”。我认为你应该使用 OR 来代替。

SELECT IF(price == null, 0, price) FROM trips 
WHERE id=9 and (prices LIKE "%|s|1|%" OR prices LIKE "%|ss|24|%");

关于MySQL IF ELSE 真假,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50367595/

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