Solved

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

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

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Having just graduated from college and entered the workforce, I don’t find myself always using the tools and programs I grew accustomed to over the past four years. However, there is one program I continually find myself reverting back to…R.   So …
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 goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.

706 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now