AI Resource Pro / website / scripts / check-remaining-tags.sql
| 1 | -- Show all posts that still have tags, along with their tag contents |
| 2 | SELECT |
| 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 |
| 10 | FROM posts |
| 11 | WHERE tags IS NOT NULL |
| 12 | AND array_length(tags, 1) > 0 |
| 13 | ORDER BY title; |