vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=252)
-   -   SQL query to assign threads a prefix (https://vborg.vbsupport.ru/showthread.php?t=326037)

kgroneman 01-29-2018 02:29 PM

SQL query to assign threads a prefix
 
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.

Inna 02-06-2018 09:17 AM

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:
Code:

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 [DATE]1517934535[/DATE] at [TIME]1517934535[/TIME] ---------------

This worked with a slight modification to achive my desired results:
Code:

UPDATE vb_thread SET prefixid = '1' WHERE forumid = 10 and prefixid <> '3' and prefixid <> '2'
All good now. Thanks.

Inna 02-06-2018 02:30 PM

You can use AND query
Code:

UPDATE `thread` SET `prefixid` = 'test' WHERE `forumid` = 1 AND 'prefixid' =''
--------------- Added [DATE]1517935538[/DATE] at [TIME]1517935538[/TIME] ---------------

My appreciation my friend


All times are GMT. The time now is 05:31 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01131 seconds
  • Memory Usage 1,711KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (3)bbcode_code_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (4)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete