![]() |
#2
cnfarer2010-09-17 08:24
|
select top 8 n.id,n.title,n.createTime,c.[name],count(com.id) as comCount,
c.id as caId
from news n
left join category c on n.caId = c.id --inner join速度慢
left join comment com on com.newsId = n.id
group by n.id,n.title,n.createTime,c.[name],c.id
order by comCount desc
总共3张表 news(新闻表),category(分类表),comment(评论表)
-- 100万条数据 2秒多
-- 300万条数据 8秒多
时间有点长,效率态低,怎么解决啊?