Solved

wordpress - sql query - comments table - replace mutiple words with random words

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

on comments table

What sql query will replace

by choose words randomly

word1 replaced with {word2|word3|word5}
word6 replaced with {word7|word8|word9}


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 26

Accepted Solution

by:
Zberteoc earned 500 total points
Comment Utility
Assuming you have 3 replaceing words to choose from you can use:
UPDATE your_table SET 
	your_field = 
		case FLOOR(RAND() * (3)) + 1
			when 1 then REPLACE(your_field, 'word1', 'word2')
			when 2 then REPLACE(your_field, 'word1', 'word3')
			when 3 then REPLACE(your_field, 'word1', 'word5')
		end
WHERE <condition_here

Open in new window

Similarly you will proceed with the replace for the word6
0

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

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.
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 …
The purpose of this video is to demonstrate how to set up the permalinks on a WordPress Website. This will be demonstrated using a Windows 8 PC. Go to your WordPress login page. This will look like the following: mywebsite.com/wp-login.php : Go t…
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…

772 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

10 Experts available now in Live!

Get 1:1 Help Now