select count(*), '>= 10000 views', case when score > 5 th...

0

Please login or register to vote for this query.

(click on this box to dismiss)

Stack Overflow

Q&A for programmers

select count(*), '>= 10000 views', 
case when score > 5 then '>5 score' 
when score = 4 then '4 score' 
when score = 3 then '3 score' 
when score = 2 then '2 score' 
when score = 1 then '1 score' 
else '>= 0 score' end
from Posts
where PostTypeId = 1 
and ViewCount >= 10000
and CreationDate <= GETUTCDATE() - 365 * 1.5
group by case when score > 5 then '>5 score' 
when score = 4 then '4 score' 
when score = 3 then '3 score' 
when score = 2 then '2 score' 
when score = 1 then '1 score' 
else '>= 0 score' end

Enter Parameters

Options:
Switch sites:
loading Hold tight while we fetch your results
:records returned in :time ms:cached