Having a sqlite3 I would like to query and sum different values. The query I'm trying to do is:
SUM(CAST(amountA AS BIGINT)) as totalA, SUM(CAST(amountB AS BIGINT)) as totalB
When the query finds several results it will trigger:
error="integer overflow"
Looking at the docs of sqlite it appears that there isn't such a BIGINT, but instead, due affinity, the BIGINT is treated as an INTEGER.
Is it possible to SUM BIGINT numbers using sqlite3?
EDIT
The data type of amountA
and amountB
is TEXT. Changing it to INTEGER will trigger the same error when doing:
SUM(amountA) as totalA, SUM(amountB) as totalB
This is because the values I'm storing is 1000000000000000000
and when 10 values like those are stored, when summing them it will overflow as it overflows a 8 bytes signed integer