PDA

View Full Version : SQL Query required to Prune forum


alirex
06-23-2014, 07:17 PM
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, 08:08 PM
This should work

DELETE FROM forum
WHERE threadcount = 0 AND parentid != -1;


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

alirex
06-24-2014, 11: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, 04: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, 04:57 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"

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

ForceHSS
06-27-2014, 05:05 PM
DELETE FROM `forum` WHERE `threadcount`='0' AND `parentid`='-1'
Please do a backup before running this