Not sure how you want the output to be. Here is one try:Declare @T table( AnswerID int, QuestionID int, SurveyID int)insert @tselect 1, 2, 1 union allselect 2, 1, 1 union allselect 3, 2, 2 union allselect 4, 3, 1 union allselect 5, 1, 3select surveyID, (count(QuestionID)*1.0/t2.total)*100.00 as cntfrom @t t1cross join(select count(questionid) as total from @t) t2group by surveyid, t2.total
Harsh AthalyeIndia."The IMPOSSIBLE is often UNTRIED"