参考(一周内评论最多的5条新闻):
select commentnews.news_id,news.news_title,count(commentnews.news_id)as num from commentnews,news where commentnews.news_id=news.news_id and commentnews.comment_time>SUBDATE(NOW(),INTERVAL 7 DAY) group by commentnews.news_id  order by num desc limit 0,5

解决方案 »

  1.   

    最好是在访问的时候记录一个点击率(update table set count=count+1)
    以后就 select * from table order by count desc
      

  2.   

    要建一个表来存放点击的时间
    例:一周内点击最多的5种游戏
    select top 5 id_game,count(id_game) as num from game_dj_count where dj_time >=dateadd(day,-7,getdate()) and dj_time <=getdate() group by id_game  order by num desc
      

  3.   

    每周的开始清空复位这个count