Branchwell

Become a Pro / website · becomeapro.ai / scripts / check-remaining-tags.sql

Raw 345 B on 5069836c1e4c4e369ebe86b13dc7d299c5bed8c0
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;