[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

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

Posted on 2014-01-29
1
Medium Priority
?
253 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 2000 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

Moving data to the cloud? Find out if you’re ready

Before moving to the cloud, it is important to carefully define your db needs, plan for the migration & understand prod. environment. This wp explains how to define what you need from a cloud provider, plan for the migration & what putting a cloud solution into practice entails.

Question has a verified solution.

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

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.
In this series, we will discuss common questions received as a database Solutions Engineer at Percona. In this role, we speak with a wide array of MySQL and MongoDB users responsible for both extremely large and complex environments to smaller singl…
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…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Suggested Courses

656 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