设为首页 加入收藏

TOP

sybase iq分组排序取前N名
2014-11-23 22:38:07 来源: 作者: 【 】 浏览:9
Tags:sybase 分组 排序

sybase iq分组排序取前N名
营业部客户资产前5客户语句
Sql代码 www.2cto.com
select
*
from
(
select
*
from #ADO_TEMP
)t1 where exists
(
select count(1) from #ADO_TEMP t2 where t1.营业部=t2.营业部 and t1.总资产>t2.总资产
having count(1)<5
) order by t1.营业部,t1.总资产 desc
;
oracle可以用rank()函数,sybaseiq也有rank(),但是我那机器版本不支持
rank() over(partition by t2.org_full_name order by t1.总资产 desc) pm
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
分享到: 
上一篇union all的执行顺序 下一篇Sybase ASA中几个非常有用的存储..

评论

帐  号: 密码: (新用户注册)
验 证 码:
表  情:
内  容: