大师的sql:
with t(lvl,kp,pg,pj) as (select 1 lvl,
5 kp,
5 pg,
5 pj
from dual
union all
select lvl + 1,
floor(t.kp/2),
floor(t.pg/4),
t.pj + floor(t.kp/2) + floor(t.pg/4)
from t
where t.kp >=1 or t.pg >=4)
select * from t
其实这是with的递归调用。 比较经典,收藏