Thread:Project:Support desk/Omitting maintenance categories in sql query/reply

You need to exclude hidden categories. They have page properties (from page_props table) with pp_propname='hiddencat';