0

動作していないように見える ingresql のコードがいくつかあります。同じタイプの問題を使用して Postgres でこれを試してみたところ、問題なく動作しました。イングレスで試してみると、大きな問題があります。

select sum(case when date_part('year', order_dt) = 2015 then invoice_amt else 0 end) last_yr
    ,sum(case when date_part('year', order_dt) = 2016 then invoice_amt else 0 end) sales
    ,s.group_cd
    ,sum(s.on_hand) on_hand
from invoicehist ih
left join invitemhist iih 
on iih.order_no = ih.order_no
left join stock s
on s.stock_no = iih.stock_no
where date_part('year', order_dt) >= 2015 and date_part('month', order_dt) = 1
group by s.group_cd

私が得るエラーは次のとおりです。

Syntax error on 'then', the correct syntax is:  SELECT [ALL|DISTINCT] target_list FROM table(s) [WHERE serch_cond]
[GROUP BY col(s)] [HAVING] search_cond]
[UNION subselect] [ORDER BY col(s)]
4

0 に答える 0