select row_number() over (order by count(id) desc), first...

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 count(id) desc), firstname, count(id) from
(select
id, iif(charindex(' ', displayname) > 0,
    substring(displayname, 1, charindex(' ', displayname) - 1),
    displayname) as firstname
    from users) as u
    where len(firstname) >= 3
group by firstname
having count(id) > 100
order by count(id) desc

Enter Parameters

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