Q&A for professional and enthusiast programmers
declare @thankYouCount float; declare @commentCount float; select @thankYouCount = count(1) from Comments c where len(c.Text) < 25 and (c.Text like '%thank you%' or c.Text like '%thanks%') select @commentCount = count(1) from Comments select @thankYouCount [total thanks comments], @commentCount [total comments], (@thankYouCount / @commentCount) * 100 [percent]