日期:2014-05-20  浏览次数:20722 次

一个简单的问题,麻烦大家帮个忙,急啊
各位高手,帮个忙解决一下这个问题啊,十分感谢了!!

这是一个发贴的表的结构:

id(标识列),sid(贴子版块号),ttopic(贴子标题),tcontents(贴子内容),tclickcount(点击次数)

问题:

显示各版块点击率最高的贴子,结果要求如下

id     sid     topic     tcontents                                     tclickcount
3       1         求助!     各位帮个忙....                                 1000     (点击率最大的)

------解决方案--------------------
select id,sid,topic,tcontents,tclickcount
from tab t1
where t1.tclickcount=(select max(tclickcount) from tab t2 where t2.id=t1.id)
------解决方案--------------------
select * from tablex where tclickcount = (select MAX(tclickcount) from tablex)
------解决方案--------------------
按照点击率倒序排序 就可以了 然后取第一个
------解决方案--------------------
按照上面写
重复应该会显示多条最高点击率相同的数