• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 279
  • Last Modified:

wordpress - sql query - post table - update all publish dates with a random

On wordpress 3.8

on the posts table

What sql query will...

update all publish dates with a random date between two dates  


I have 10 questions, highest point level - open about sql queries

Soo, Lots of points for an sql guy
1 Solution
David L. HansenProgrammer AnalystCommented:
Try this:
UPDATE $wpdb->posts
SET post_modified_gmt = (select 
from  (
    select top 1
        dateadd(day, -abs(checksum(newid())) % 100, convert(date, getDate())) StartDate
    from sys.columns c1, sys.columns c2
) X)
WHERE post_status = 'publish'

Open in new window

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now