select count(*) from cms_article ca where 某个TagID in (select cat.tag_id from cms_article_tag cat where ca.id=cat.article_id)
IN
subquery performance is when
the subquery returns a small number of rows but the outer query returns a large number of rows to be compared to the subquery result.select count(*) from cms_article ca RIGHT JOIN cms_article_tag cat ON cna.id = cnat.article_id WHERE cnat.tag_id=某TagID
版权声明:本文为博主原创文章,未经博主允许不得转载。
原文地址:http://blog.csdn.net/wenniuwuren/article/details/47350469