firenze icon indicating copy to clipboard operation
firenze copied to clipboard

sum() column function not working properly

Open joeolaoye opened this issue 7 years ago • 1 comments

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) {}):

joeolaoye avatar Aug 23 '17 08:08 joeolaoye

The work around is to select the whole column and loop through it which is inefficient.

joeolaoye avatar Sep 14 '17 14:09 joeolaoye