MySQL query to add postmeta values for a specific author
-
I’m trying to add the values of all post meta entries for a specific author and getting completely stuck. So far I have this, which adds every single entry (half the battle). However I only want the current user:
$values = $wpdb->get_col( "SELECT meta_value FROM $wpdb->postmeta WHERE meta_key = 'spt_cpdlog_points'"); $cpdlogpoints = "" . array_sum($values) . "";
I’ve tried using a LEFT JOIN to cross reference the posts table with the postmeta table but I can’t get it to work. Anyone able to help?
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘MySQL query to add postmeta values for a specific author’ is closed to new replies.