感谢:https://bbs.csdn.net/topics/392325432
表名 t1
价格类型 a
价格 pri
数量 shul
天数 ts
select case
when a = 'a2' then
t.shul * t.pri * (round(t.ts / 30) + 1)
when a = 'a1' then
t.shul * t.pri * t.ts
end as 价格,
t.*
from t1 t;
给你参考。