Overflow or underflow


E1207 08:36:54.804875 10927 MapDHandler.cpp:3260] Exception: Overflow or underflow

Running into it on a rather simple query:
select st, sum(wgtp*valp)/sum(wgtp) from hums group by st;

valp is integer, wgtp is a smallint.
max valp is 5873000. wgtp in this row is 1150.

Is there any way to convert calculated value into a bigint without altering of the table?



Please try CASTing your result to BIGINT or DOUBLE depending on what kind of output you want


select st, sum(CAST(wgtp*valp) as BIGINT) / sum(wgtp) from hums group by st;

Without knowing your types, you may have to experiment a little with what you need to CAST