ranking - SQL Server Rank() Cap for each column -


i have sql query has 3 int columns, , 3 rank() functions partition by ranks 3 columns.

the question is, want rank 5000 each column, , stop after that. there anyway in single query without splitting 3 queries? still want of data first 3 columns, want rank() columns go null after 5000.

each partition go 5000.

thanks

you use case statement.

... case when row_number() on (<partition by>) <= 5000       <rank function>       else null  end ... 

Comments

Popular posts from this blog

c# - How to set Z index when using WPF DrawingContext? -

razor - Is this a bug in WebMatrix PageData? -

visual c++ - Using relative values in array sorting ( asm ) -