View Full Version : SQL query to assign threads a prefix
kgroneman
01-29-2018, 02:29 PM
I'm needing to assign all threads in a specific forum that do not currently have a prefix to an existing prefix. Is there some kind soul out there that could show me an SQL query that would do such a thing? I sure would appreciate it. Thanks in advance.
First, in "prefix" table of vBulletin find your desired "prefixid" (it could be an alphabetic name or numerical one). In my case, it's id is "test".
Now run this query in "thread" table:
UPDATE `thread` SET `prefixid` = 'test' WHERE `forumid` = 1;
Where forumid is the id of your desired forum.
Before running any query, please make a backup of your thread table.
kgroneman
02-06-2018, 01:56 PM
Thanks! much appreciated. This looks like it may set ALL threads to that prefix instead of just threads without a prefix, but what do I know. :-) I'll test it out before using it in a critical forum and report back.
--------------- Added 1517934535 at 1517934535 ---------------
This worked with a slight modification to achive my desired results:
UPDATE vb_thread SET prefixid = '1' WHERE forumid = 10 and prefixid <> '3' and prefixid <> '2'
All good now. Thanks.
You can use AND query
UPDATE `thread` SET `prefixid` = 'test' WHERE `forumid` = 1 AND 'prefixid' =''
--------------- Added 1517935538 at 1517935538 ---------------
My appreciation my friend
vBulletin® v3.8.12 by vBS, Copyright ©2000-2024, vBulletin Solutions Inc.