View Full Version : sql query recursive exclude forums
Mooff
08-04-2011, 04:02 PM
Hi guys,
i'm trying to catch some information out of our board, but want to exclude specific categories, their subforums and the subforums of those subforums.
Is there an easy way to use a vb-function which allready does this in my custom sql query?
Help is greatly appreciated.
Disasterpiece
08-04-2011, 10:04 PM
... WHERE forumid NOT IN 1,2,3,4,5,...
Applying this for subforums as well might be harder, where writing down all forums regardless of sub- or parenting forums are excluded.
Mooff
08-04-2011, 10:57 PM
I know how to write it by hand. But that's not want i want. It has to be automated since we will add a lot of boards in those categories over the time (and it does affect more than 50 subforums as of right now - i didn't count).
So i'm looking for a vb-function which allready does what i want. There should be something in the search? Where one can search through a whole category.
The 'childlist' column of the forum table is a comma-separated list of all the children (and the children's children, etc) of a forum (The list includes the forum itself and -1, for some reason - maybe to mark the end of the list?). If you have the forum info (or the forum cache is filled in so you can get the info) you should be able to do something like "WHERE forumid NOT IN $forum['childlist']". (Or I suppose you could just use the field name if your query includes the forum table).
vBulletin® v3.8.12 by vBS, Copyright ©2000-2024, vBulletin Solutions Inc.