First Name


Please login or register to vote for this query.

(click on this box to dismiss)

Stack Overflow en español

Preguntas y respuestas para programadores y profesionales de la informática

declare @pagenum int = 50;

case when CharIndex( ' ', displayname )=0 then lower(displayname) else
  Substring( lower(displayname), 1, CharIndex( ' ', displayname ) - 1)
  end as firstname,
  id cnt,
  reputation rep,
  upvotes upv,
  downvotes downv
  into #temp
from users where year(LastAccessDate)=year(getdate())

select ROW_NUMBER()OVER( order by cnt desc,firstname) num,* into #out from #temp

order by cnt desc

select * from #out
where num between (@pagenum-1)*50000+1 and @pagenum*50000
order by cnt desc , firstname

Enter Parameters

Switch sites:
loading Hold tight while we fetch your results