• Resolved 34503895

    (@34503895-1)


    What is the SQL code to run when the scope is to increase a given postmeta value by a given amount for all tables?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Hey @34503895-1,
    Check below example.

    UPDATE wp_postmeta
    SET meta_value = meta_value + 10
    WHERE meta_key = 'view_count'
    AND meta_value REGEXP '^-?[0-9]+$';

    Best Regards
    Ravindra Singh Meyda

    Thread Starter 34503895

    (@34503895-1)

    Wow, thank you Ravindra Singh Meyda, works like a charm.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘SQL: How to increase postmeta value for all posts by a given value?’ is closed to new replies.