SELECT ROW_NUMBER() OVER (ORDER BY (voteqqcount+votecount) Desc) AS rank, * FROM PAS_VoteShowCase where tid=(select top 1 id from PAS_VoteActivity order by indexsort asc,PublishTime desc)