Solved

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

Posted on 2014-01-29
1
225 Views
Last Modified: 2014-09-19
On wordpress 3.8

on the posts table

What sql query will...

update all publish dates with a random date between two dates  



P.S.

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

Soo, Lots of points for an sql guy
0
Comment
Question by:Matt_Walker01
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 15

Accepted Solution

by:
David L. Hansen earned 500 total points
ID: 39818509
Try this:
UPDATE $wpdb->posts
SET post_modified_gmt = (select 
    X.StartDate 
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

0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Does the idea of dealing with bits scare or confuse you? Does it seem like a waste of time in an age where we all have terabytes of storage? If so, you're missing out on one of the core tools in every professional programmer's toolbox. Learn how to …
I annotated my article on ransomware somewhat extensively, but I keep adding new references and wanted to put a link to the reference library.  Despite all the reference tools I have on hand, it was not easy to find a way to do this easily. I finall…
The viewer will learn how to implement Singleton Design Pattern in Java.
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

735 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question