| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 759 人关注过本帖
标题:请教下SQL高手,看一下这条SQL还能优化吗?有没有问题
取消只看楼主 加入收藏
wangzi001
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2012-1-11
结帖率:0
收藏
已结贴  问题点数:20 回复次数:0 
请教下SQL高手,看一下这条SQL还能优化吗?有没有问题
SELECT * FROM (
select a.topicID,a.topicTitle,a.playerUID,b.nickName as nickName1,a.sectionID,c.sectionName,CONVERT(varchar(19),a.createTime,120) as createTime,a.isBest,a.isTop,a.isSys,d.nickName as nickName2,isnull(a.lastreplyUID,0) as lastreplyUID,CONVERT(varchar(19),a.lastreplyTime,120) as lastreplyTime,a.viewNum,a.replyNum,b.headIcon,d.headIcon as headIcon2,a.abstract,datediff(mi,a.createTime,getdate()) as isNews,TitleColor,'' TitleColorStr, ROW_NUMBER() OVER( order by a.issys desc,a.istop desc, isnull(a.lastreplytime,a.createtime) desc) as _rownum
FROM tb_forumtopic a inner join tb_playerinfo b on a.playeruid=b.playeruid inner join tb_forumsection c on a.sectionid=c.sectionid left join tb_playerinfo d on a.lastreplyuid=d.playeruid  
where (a.status=1 and c.status=1 and c.type=1 and a.sectionid in
(select sectionid from tb_forumsection where parentid=84)) or ( a.status=1 and c.status=1 and a.issys=1 )) as tab
WHERE _rownum between 1 and 25 order by _rownum asc
搜索更多相关主题的帖子: 优化 
2012-01-11 14:40
快速回复:请教下SQL高手,看一下这条SQL还能优化吗?有没有问题
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.024314 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved