ghost 常用sql

查询已发布但是未整理目录的帖子

select id, title,slug,published_at,status from posts p where status = 'published' 
and not exists (
 select 1 from posts pp where pp.page<>0 and pp.plaintext like CONCAT('%',p.slug,'%')
 );

查询已发布但是无标签的帖子

select id, title,slug,published_at,status from posts p where status = 'published' and not exists (select 1 from posts_tags pt where p.id = pt.post_id);