回复最新查询
create table article(aid int identity(1,1) primary key,
sid int not null,--类别ID
atitle varchar(100) not null,--文章标题
acontent text not null,--文章内容
mid int not null,--发布人ID
adate datetime not null,--发布时间
anum int not null,--浏览量
)
select a.* from article a join (select pid,adate=max(adate) from article where pid<>0 group by pid) b on (a.aid=b.pid) order by b.adate desc
这里没有回复的不能显示,谁能帮我改一下啊!
拿几条数据作范例说明下 就是把最新回复的显示在最前面,而没有回复的显示在后面
[attach]36914[/attach] select * from a order by 回復時間﹐回復內容 desc
這樣好像就可以
[[it] 本帖最后由 西风独自凉 于 2008-9-4 15:31 编辑 [/it]] 好象不行,不过还是谢谢楼上 4楼的排序应该对啊。。按照回复时间最新排列
页:
[1]
