csseur3
Member
Posted 3 years ago #
Hello,
this is my query:
$test_count = $wpdb->get_var($wpdb->prepare("SELECT COUNT(*) FROM $wpdb->postmeta WHERE meta_key LIKE '%salon%'", $meta_key));
I have many posts with meta_key "salon_irc" and "salon_jabber", so, my query count only the posts with "salon_jabber" meta_key :( why?
bye
frank8265
Member
Posted 3 years ago #
Hi csseur3,
Can you tell me how you resolved this?
I've got the same sort of problem. :-/
Thanks.
Frank
csseur3
Member
Posted 3 years ago #
$stat_all_chat = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->posts a WHERE EXISTS (SELECT meta_id FROM $wpdb->postmeta WHERE post_id = a.ID AND meta_key in ( 'salon_irc', 'salon_jabber'))");
:)