Solved

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

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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Introduction Since I wrote the original article about Handling Date and Time in PHP and MySQL (http://www.experts-exchange.com/articles/201/Handling-Date-and-Time-in-PHP-and-MySQL.html) several years ago, it seemed like now was a good time to updat…
Whether you’re a college noob or a soon-to-be pro, these tips are sure to help you in your journey to becoming a programming ninja and stand out from the crowd.
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 member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

810 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