...
Code Block |
---|
| sql |
---|
| sql |
---|
title | SQL to see missing categories |
---|
|
DELETE
FROM categories c
WHERE
categoryid NOT IN (SELECT objectid FROM nested_tree_objects)
|
However, you may have some orphaned categories in the nested tree model. ie those category references that have lost their parent (maybe through a deletion that didn't finish properly). You can grab a list of orphaned nested tree references using the following:
Code Block |
---|
| sql |
---|
| sql |
---|
title | SQL to check for orphan tree references |
---|
|
SELECT *
FROM nested_tree_objects
WHERE
parentid NOT IN (SELECT objectid FROM nested_tree_objects)
AND parentid <> ''
|