select upper(substring(title,1,charindex(' ',title+' ')-1...

0

Please login or register to vote for this query.

(click on this box to dismiss)

Gardening and Landscaping Meta

Q&A about the site for gardeners and landscapers

select upper(substring(title,1,charindex(' ',title+' ')-1)) as firstword,
count(*) as number,
avg(score) as avgscore,
sum (case when closeddate is null then 0 else 1 end) as numberClosed,
cast (100*avg(case when closeddate is null then 0.0 else 1.0 end) as decimal(5,2))
as percentage
from posts
group by  upper(substring(title,1,charindex(' ',title+' ')-1))
having count(*)>2
order by avg(score) desc

Enter Parameters

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