oracle 求百分比解决思路

oracle 求百分比表Id cr_idtimuxuhaodaan12第1题Ais22第1题Bon32第2题A第2题A42第2题B第2题B52第2题C第2题

oracle 求百分比


Id cr_id timu xuhao daan
1 2 第1题 A is
2 2 第1题 B on
3 2 第2题 A 第2题 A
4 2 第2题 B 第2题 B
5 2 第2题 C 第2题 C
6 2 第2题 D 第2题 D
3 3 第1题 A 第1题 A
4 3 第2题 B 第2题 B
5 3 第2题 C 第2题 C
6 3 第2题 D 第2题 D


想要得到 
timu xuhao cout baifenbi
第1题 A 2 2/ 3
第1题 B 1 1/3
第2题 A 1 1/7
第2题 B 2 2/7
第2题 C 2 2/7
第2题 D 2 2/7


在线等啊..!求大哥解答

[解决办法]

SQL code
select t1.timu timu ,t1.xuhao  xuhao ,t1.cout cout,t1.cout||'/'||t2.cout_sum baifenbifrom (select timu ,xuhao ,count(1) cout  from tb group by timu,xuhao )t1,(select timu ,count(1) cout_sum  from tb group by cr_id)t2 where t1.timu=t2.timuorder by timu ,xuhao