Recently we're building the analytics functions. In one SQL query of analytics functions, we found that the SUM() result is a string not a number. That causes the final total number is a string connecting result, not a number sum result.
Search this situation on the Google. There is an issue in Sequelize project page.
https://github.com/sequelize/sequelize/issues/8713.
The reason is that SUM() result's type is NEWDECIMAL
that is coming across as Javascript String
.
To set a SUM() result as DECIMAL
is reasonable. Because the SUM() result may be float type. If SUM() result is a number, there would be floating point issue.
So using DECIMAL
as a String
type data is necessary.