同事教给偶的sql server 2005里的rank() over

李家佳(李家佳) 12:18:37
select * from
(
select username,SectionID,ExpertPoint, rank() over(partition by username order by ExpertPoint desc)
 tt from [UserSectionProfiles] where UserName in
('ghj1976','daisy8675')

) xx where xx.tt between 2 and 3

否则要写一个很麻烦的子查询。先记下,回头再补充全

posted @ 2009-02-13 12:22  new 维生素C.net()  阅读(675)  评论(0编辑  收藏  举报