select id,f1,f2,count(f1) over(partition by f1)/(select count(*) from table) p_f1,
count(f2) over(partition by f2)/(select count(*) from table) p_f2 from table
order by idid f1 f2 p_f1 p_f2
----------------------
1 a b 0.5 0.5
2 b a 0.25 0.25
3 a c 0.5 0.25
4 c b 0.25 0.5
count(f2) over(partition by f2)/(select count(*) from table) p_f2 from table
order by idid f1 f2 p_f1 p_f2
----------------------
1 a b 0.5 0.5
2 b a 0.25 0.25
3 a c 0.5 0.25
4 c b 0.25 0.5
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货