Author Topic: Sum, Average, Min or Max for nullable fields  (Read 1781 times)

TeeJT

  • Pro Ultimate
  • Jr. Member
  • *
  • Posts: 88
    • View Profile
Sum, Average, Min or Max for nullable fields
« on: June 02, 2017, 12:43:59 pm »
Is it possible for nullable fields linked to a column that the null values can be treated as 0 instead of undefined as in the example attached

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6310
    • View Profile
Re: Sum, Average, Min or Max for nullable fields
« Reply #1 on: June 02, 2017, 02:47:30 pm »
For that you can write your own function pq.aggregate.max which treats null values as 0. It would override the inbuilt function.