select *, row_number() over(order by viewcount desc) as r...

0

Please login or register to vote for this query.

(click on this box to dismiss)

Stack Overflow

Q&A for professional and enthusiast programmers

select *, row_number() over(order by viewcount desc) as rank 
from (select top 20 * from posts 
where viewcount > 0 and owneruserid > 0
order by viewcount asc) q

Enter Parameters

Options:
Switch sites:
loading Hold tight while we fetch your results