select
sum(case when xm="张三" and wjmc ="钢笔" then JR else 0 end) / sum(JR)
from
tabname
_______________
SELECT
xm,
wjmc,
t1 / t2 AS t3
FROM
(
SELECT
xm,
wjmc,
sum(JR) AS t1
FROM
tabname
GROUP BY
xm,
wjmc
)
LEFT JOIN (SELECT sum(JR) AS t2 FROM tabname) b ON 1 = 1