SQL Query Issues
-
Could anyone let me know why this would not be working? I get confused between OR and AND ??
I need to get anything that is Blue eyes or Blonde hair. At the moment this gets nothing.
SELECT wp_posts.ID FROM wp_posts INNER JOIN wp_postmeta ON wp_posts.ID = wp_postmeta.post_id WHERE ((wp_postmeta.meta_key = 'eyes' AND wp_postmeta.meta_value = 'Blue' OR wp_postmeta.meta_key = 'hair' AND wp_postmeta.meta_value = 'Blonde')) AND ((wp_postmeta.meta_key = 'availability' AND wp_postmeta.meta_value >= '1' AND wp_posts.post_type = 'post' AND wp_posts.post_status = 'publish'))
Thanks in advance!
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘SQL Query Issues’ is closed to new replies.