开发者

Optimizing a forum query

Can you guys help me optimize this query. What's a more efficient way to do this?

SELECT *, ( 
         SELECT COUNT(i开发者_如何学JAVAd) FROM post WHERE created > 1288953377 AND topic_id = topic.id
    ) AS post_today FROM topic


I guess this is what you need,

SELECT Col1,Col2,Col3, Count(id) from Topic 
LEFT JOIN post on topic_id = topic.id
where created > 1288953377
group by id,Col1,Col2,Col3
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜