gpt4 book ai didi

Mysql查询返回0个结果

转载 作者:可可西里 更新时间:2023-11-01 08:29:49 25 4
gpt4 key购买 nike

鉴于这两行中的值,为什么我的查询返回 0 行以及如何重写查询才能正常工作?

meta_id post_id meta_key   meta_value
1422 73 wpcf-milk 22
1423 73 wpcf-mw -7

SQL 查询:

   SELECT * FROM wp_postmeta
WHERE post_id = 73
AND ( meta_key = 'wpcf-mw' AND meta_value BETWEEN -8 AND 200 )
AND ( meta_key = 'wpcf-milk' AND meta_value BETWEEN 20 AND 200 )

最佳答案

SELECT * FROM wp_postmeta 
WHERE post_id = 73
AND (( meta_key = 'wpcf-mw' AND meta_value BETWEEN -8 AND 200 )
**OR** ( meta_key = 'wpcf-milk' AND meta_value BETWEEN 20 AND 200 ))

用 OR 改变 AND。

关于Mysql查询返回0个结果,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30087862/

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