How to obtain a percent of entries?

W

wmoening

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).
 
J

John Spencer (MVP)

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
 
Top