被点击查看的文章次数最多点击次数直接放在 tableArc 表里就可以阿!

解决方案 »

  1.   

    因为这列是经常要更新的,所以另外建一个表
    用oid关联tableArc表
    查询的时候关联查询也可以
      

  2.   

    简单的说:
    ——————————————————————————————————————————
    文章信息表 tableArc
    ---------------------------
      oid (唯一标志符)
      title (文章标题) 
      uid (文章发布者ID)
    阅读记录表 tableRead
    ---------------------------
      nid (唯一标志符)
      oid (文章编号)
      rid (读者编号)
      dates (阅读时间)——————————————————————————————————————————create table tableArc (oid int identity(1,1),title varchar(50),uid int)
    create table tableRead(nid int identity(1,1),oid int,dates datetime)select
        top 20 TA.*
    from
        tableArc TA,
        (select oid,count(*) as times from tableRead TR where datediff(dd,dates,getdate())<7 group by oid) VR
    where
        TA.oid=VR.oid
    order by
        VR.times desc
      

  3.   

    多谢 libin_ftsafe(子陌红尘:当libin告别ftsafe),
    在两个分栏里你都回答了....
    不过会两边都给分的...
    我理解一下,会尽快结贴,
    还有其它的朋友给些什么建议吗?