如题,表是这样的:
表名bbs
id
title(标题)
content(内容)
father_id(回复的帖子对应主题的id,如果是主题则为空)
layer(为0时表示这是新主题,为1时表示为回复的帖子)
adddate(添加的时间)
------解决方案--------------------
select* from bbs where layer in(select layer from bbs where layer=1) order by adddate
照你的说法应该是这样的
------解决方案--------------------
select * from bbs order by layer desc,adddate desc
------解决方案--------------------
ACCESS:"select * from bbs GROUP BY father_id order by max(adddate)"
在ASP语句需要注意一下:
if(rs("layer")=1) then id=rs("father_id")
思路上是这样 对不对我还没有试过
------解决方案--------------------
select a.*,b.* from bbs a left join bbs b where a.id = b.parent_id and a.parent_id = null and not b.parent_id=null order by a.adddate,b.adddate desc
不知道这样行不行..