Support

Account

Home Forums General Issues Query for sum Acf field

Unread

Query for sum Acf field

  • Hi,

    I want to summ my field ‘nb’ from my post_type ‘exploitation’, i don’t understand what is wrong with this…Thanks for help

    $total = $wpdb->get_col(“SELECT SUM(pm.meta_value) FROM {$wpdb->postmeta} pm
    INNER JOIN {$wpdb->posts} p ON p.ID = pm.post_id
    WHERE pm.meta_key = ‘nb’
    AND p.post_type = ‘exploitations'”);

Viewing 1 post (of 1 total)

The topic ‘Query for sum Acf field’ is closed to new replies.