1. Get rid of all advertisements and get unlimited access to documents by upgrading to Premium Membership. Upgrade to Premium Now and also get a Premium Badge!
Asingwire Cuthbert

Good sql snippet 1

good grouping sql snippet

Tags:
  1. Asingwire Cuthbert
    select q.Body AS [Question],
    ot.OptionText AS [Option],
    count(ot.OptionText) [Total]
    from OptionTypes ot left outer join
    Answers a on a.Value = ot.OptionText left outer join
    Questions q on q.Id = a.QuestionId left outer join
    Surveys s on s.id = q.SurveyId where s.Id=1 group by q.Body, ot.OptionText order by q.Body asc, count(ot.OptionText) desc