vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=251)
-   -   SQL Query required to Prune forum (https://vborg.vbsupport.ru/showthread.php?t=312373)

alirex 06-23-2014 06:17 PM

SQL Query required to Prune forum
 
Dear Helpers

I need a SQL query to remove my empty forums which have no thread . Due to some changes i need to delete many forums on my board and it will take hours to delete one by one. I am not able to find Prune empty forum in my adminCP.

Thank you in advance

vBNinja 06-23-2014 07:08 PM

This should work
PHP Code:

DELETE FROM forum 
WHERE threadcount 
AND parentid != -1

Run it through phpmyadmin then go to admincp->maintenance->rebuild forum information

alirex 06-24-2014 10:47 AM

Thank You very much " vBNinja "

One problem i am facing

#1093 - You can't specify target table 'forum' for update in FROM clause

vBNinja 06-24-2014 03:44 PM

You probably have a table prefix, look for "forum" in the tables with phpmyadmin
If it has something in front of it, use that name in the query instead of "forum"

alirex 06-27-2014 03:57 PM

Quote:

Originally Posted by vBNinja (Post 2503495)
You probably have a table prefix, look for "forum" in the tables with phpmyadmin
If it has something in front of it, use that name in the query instead of "forum"

It is forum only there is no prefix , but dont know why your command is not working.

ForceHSS 06-27-2014 04:05 PM

DELETE FROM `forum` WHERE `threadcount`='0' AND `parentid`='-1'
Please do a backup before running this


All times are GMT. The time now is 11:26 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.02551 seconds
  • Memory Usage 1,718KB
  • 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
  • (1)bbcode_php_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (6)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