PDA

View Full Version : Query Help With A Mod


paul41598
08-18-2005, 11:29 AM
I have that prefix category hack installed for 3.0.7 and it works great. I imported recently from Ubb.Classic. I want to assign a category to all my threads in a forum that have "roommate" in the thread title.

I need a query to do this else I have to edit 17 pages worth of threads. :(

I know a few things to get started. The table to be updated is 'thread' and I would be updating the 'title' , and 'category' fields.

Id like to know how to select all threads in forumid 17, with "roommate" in their title. THen I need to update all those threads and set the category = "roommate"

Any ideeas? or does that make sense?

Marco van Herwaarden
08-18-2005, 11:47 AM
Probably something like:
UPDATE thread SET category='roommate'
WHERE forumid=17 AND title LIKE '%roommate%';

paul41598
08-18-2005, 02:28 PM
ok now I havnt tried it yet, but the select statement worked with what u said.

Before I try that, how can I alter that statement to include like '%roommate%', '%roomate%', etc. Just difference variations of it, in case some titles are mispelled.

Marco van Herwaarden
08-18-2005, 07:38 PM
Just run it twice with the other options.

soniceffect
08-18-2005, 07:55 PM
Someone please correct me if this is wrong as I`ve had a few to drink ... But this is another way of doing it in one. Just add as many variations as you need.


UPDATE thread SET category='roommate'
WHERE forumid=17 AND title IN
(SELECT category FROM thread WHERE title like %roommate% OR %roomate% OR %rommate%)