1
0
dwelling-home/pkg/mindflow/database/sqlite/queries/categoryDeleteUnused.sql

6 lines
183 B
SQL

DELETE FROM `category`
WHERE `category`.`category_id` NOT IN (
SELECT `category_id`
FROM `post`
GROUP BY `post`.`category_id`
HAVING COUNT(`post`.`post_id`) > 0 );