Solved

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

Posted on 2014-01-29
1
220 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
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

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

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

Windows Script Host (WSH) has been part of Windows since Windows NT4. Windows Script Host provides architecture for building dynamic scripts that consist of a core object model, scripting hosts, and scripting engines. The key components of Window…
This article is meant to give a basic understanding of how to use R Sweave as a way to merge LaTeX and R code seamlessly into one presentable document.
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.
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.

840 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