【发布时间】:2020-12-04 06:13:25
【问题描述】:
我想让 AMY 的结果值在 300 以内。
example
270 -> 270
300 -> 300
350 -> 300
我应该如何修改它? 是否可以在Case when中使用case when?
select
no, sum(case when type = 'A' then cost else -cost end) * 0.08 as AMY
from MIKE
where
MIKE.type in ('A', 'B')
and exists (select 1 from users u where u.no = c.otaku_no)
group by no
【问题讨论】:
-
请用 one 数据库标记您的问题,这是您真正使用的数据库。
-
我正在使用 Oracle db..