Home › Forums › General Issues › Sum fields via MySQL › Reply To: Sum fields via MySQL
It is practicably not possible to do what you want to do without doing multiple queries. The reason for this is that there is no connection between the two meta fields other than the post ID column of the postmata table.
First you would need to do a query to get all of the post IDs where “type” == 1 for example. Then you would need to do a query using
"WHERE post_id IN({$LIST_OF_POST_IDs) AND meta_key = 'field_name'"
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.