简单的说: —————————————————————————————————————————— 文章信息表 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
用oid关联tableArc表
查询的时候关联查询也可以
——————————————————————————————————————————
文章信息表 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
在两个分栏里你都回答了....
不过会两边都给分的...
我理解一下,会尽快结贴,
还有其它的朋友给些什么建议吗?