【发布时间】:2017-08-09 09:14:12
【问题描述】:
当在第 3 行时,我知道我在 case 语句中做错了什么,但无法弄清楚是什么
select DISTINCT p.code, a.itemno, a.descrip, a.rev, a.class, a.std_cost, a.std_price, t.trans_in_out, t.trans_quan,
(select case when V.MIN_CUST_PRICE is null then
when V.MIN_CUST_NAT_PRICE is null then
when V.MIN_SELL_PRICE is null then 0
else V.MIN_SELL_PRICE
else V.MIN_CUST_NAT_PRICE
else V.MIN_CUST_PRICE
end
from v_sca_item_price_summary v where rownum = '1') as Value
from arinvt a, translog t, eplant e, v_sca_item_price_summary v, prod_code p
where v.arinvt_id = a.id
and a.prod_code_id = p.id
and t.eplant_id = e.id
and t.trans_date between :start_date and :end_date
【问题讨论】:
-
选择当 V.MIN_CUST_PRICE 为空时的情况(然后呢?)
-
我想说的是,如果以下任何一个 V.MIN_CUST_NAT_PRICE V.MIN_SELL_PRICE V.MIN_SELL_PRICE 为空,那么具有值的那个应该是最终结果