firenze
firenze copied to clipboard
sum() column function not working properly
I am trying to get the sum of a column but it's not working properly. it returns an array of rows rather than a single value. My code looks like this:
pendings.find()
.select(function (column) {
return column('amount')
.sum();
})
.all()
.then(function (models) {}):
The work around is to select the whole column and loop through it which is inefficient.