給定這兩行中的值,爲什麼我的查詢返回0行以及如何重寫查詢以正常工作?Mysql查詢返回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)
(meta_key ='wpcf-mw'AND meta_value BETWEEN -8 AND 200)或(meta_key ='wpcf-milk'AND meta_value BETWEEN 20 AND 200)您必須使用OR – Beto
您的意思是「正常工作」?你希望它的工作方式是什麼? – pathfinderelite
哦,Entity-Attribute-Value模型的* joys *。有趣,有趣,*有趣*。 – spencer7593