Q&A about the site for gardeners and landscapers
select substring(title,1,charindex(' ',title+' ')) as firstword, count(*) as number, avg(score) as avgscore, sum (case when closeddate=null then 0 else 1 end) as numberClosed, avg(case when closeddate=null then 0 else 1 end) as percentage from posts group by substring(title,1,charindex(' ',title+' ')) having count(*)>2 order by count(*),avg(score)