I have a WordPress database. in postmeta table we have 3 different values for each post. we update our theme 3 times and in each time the post count is different from each other. I want to make this; there are values in one table in different rows:

post id 10 value 1: better-views-count 3455
post id 10 value 2: post_stats 522
post id 10 value 3: post_views_count 52

I want to sum the three and update the result post_views_count.

How I can do it and what the sql should I use it?

I think there is no option to do it with SQL fol 1000 post it should be a php code. But I cannot image the sql which I should use it.

Read more here: SQL Collect Values from different rows and update the new one


If you know the solution of this issue, please leave us a reply in Comment section, to update the question.

Wordpress related questions and answers: