sql 一张回答记录表 统计每个题目每个答案的百分比

表
具体表现

你可以先查下这道题一共回答了几次,然后查一下回答同一答案的次数,除一下转成百分比就好了。

int a = select count(*)  from  表 where ques_id=5;
int b = select count(*)  from  表 where ques_id=5 AND answer_value=2;
    int c = a/b;

先查下这道题一共回答了几次,然后查一下回答同一答案的次数,除一下转成百分