Branchwell

AI Resource Pro / website / scripts / check-remaining-tags.sql

1-- Show all posts that still have tags, along with their tag contents
2SELECT
3 id,
4 title,
5 tags,
6 (SELECT array_agg(c.name)
7 FROM post_categories pc
8 JOIN categories c ON c.id = pc.category_id
9 WHERE pc.post_id = posts.id) as categories
10FROM posts
11WHERE tags IS NOT NULL
12AND array_length(tags, 1) > 0
13ORDER BY title;