SELECT CASE When score < 10 Then 'No Badge' When score b...

0

Please login or register to vote for this query.

(click on this box to dismiss)

The Workplace Meta

Q&A about the site for members of the workforce navigating the professional setting

-- Enter Query Title
-- Enter Query Description

SELECT 
   CASE 
        When score < 10 Then 'No Badge'
        When score between 10 and 24 Then 'Nice'
        When score between 25 and 99 Then 'Good' 
        When score > 99 Then 'Great'
   END as type,
   count(id) Badge

FROM
   posts p
WHERE
   postTypeID in (1,2)
GROUP BY 
CASE 
        When score < 10 Then 'No Badge'
        When score between 10 and 24 Then 'Nice'
        When score between 25 and 99 Then 'Good' 
        When score > 99 Then 'Great'
   END
        

Enter Parameters

Options:
Switch to main site
loading Hold tight while we fetch your results