文章的标签对应表
article_tag中就三个字段article_id、tag_id、status。
如下SQL语句的索引该怎么建最合理
select count(*) as s, article_id
from article_tag
where tag_id in (1, 2) and status = 1
group by article_id
having s = 2
order by article_id
文章的标签对应表
article_tag中就三个字段article_id、tag_id、status。
如下SQL语句的索引该怎么建最合理
select count(*) as s, article_id
from article_tag
where tag_id in (1, 2) and status = 1
group by article_id
having s = 2
order by article_id