Solved

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

Posted on 2014-01-29
1
131 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
[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 26

Accepted Solution

by:
Zberteoc earned 500 total points
ID: 39820918
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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

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 …
This article shows the steps required to install WordPress on Azure. Web Apps, Mobile Apps, API Apps, or Functions, in Azure all these run in an App Service plan. WordPress is no exception and requires an App Service Plan and Database to install
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

730 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