当我使用以下查询时,结果显示为我想要的结果:
select (TARIF + TAMBAHAN - (case when (select NILAI from PROMOTRIP where KODETRIP = OD.KODETRIP and URUTAN = OD.URUTAN) is null then 0 else (select NILAI from PROMOTRIP where KODETRIP = OD.KODETRIP and URUTAN = OD.URUTAN) end)) from ORDERDETAIL OD where KODETRIP = 'TR201408060051' and TGLBATAL is null
但是当我想添加它时,结果错误:
答案 0 :(得分:0)
尝试将第一个查询合并为嵌套查询,并在外部查询上使用SUM
。像这样:
SELECT SUM(*) FROM (YOUR_FIRST_QUERY)
答案 1 :(得分:0)
这样做。
return view('errors.404', ['msg' => 'some message']);