How to obtain a percent of entries?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a database built that uses yes or no check boxes for the data fields. What I would like to know is this. Is there a way to get a report on what percent of a single field as yes or no answers.(ie. 59% yes , 41% no).
 
SELECT QuestionID,
Sum(IIF(SomeField=True,1,0)) / Count(SomeField) as SomeFieldYPercent,
Sum(IIF(SomeField=False,1,0)) / Count(SomeField) as SomeFieldNPercent
FROM YourTable
Group By QuestionID
 
Back
Top