Henry Olive 5 Posted May 2, 2021 Interbase, SELECT IM.ITEMNO, SUM(Case When IM.TNAME = 'Sell' then IM.QTY * (IM.UPRICE * IM.CURRRATE) else 0 end) FROM ITEMMOVEMENTS IM GROUP BY IM.ITEMNO I get Integer Overflow error msg. I Tried SUM(Case When IM.TNAME = 'Sell' then CAST(IM.QTY * (IM.UPRICE * IM.CURRRATE) AS NUMERIC(18,2)) else 0 end) I again get Integer Overflow error msg. I also tried CAST(SUM(Case When IM.TNAME = 'Sell' then IM.QTY * (IM.UPRICE * IM.CURRRATE) else 0 end) AS NUMERIC(18,2)) I again get Integer Overflow error msg. Any suggestion ? Thank You Share this post Link to post
Guest Posted May 2, 2021 Break it out with samples, select (mYConundrum) from rdb$database Put different values/operations/operands into MyConundrum to figure out a fool-proof case statement. Share this post Link to post