Software developer

Primary tabs

SQL, Caché

How to calculate median and mean in SQL?

  • 0
  • 0
  • 144
  • 4
  • 1


Check these SQL functions:

That's great, but unfortunately, we've not upgraded to the latest and greatest. We're still using the 2015 release.

Can you ballpark the workload?

If it's not too big, I think the easiest solution would be just writing ObjectScript method that calculates what you need.

AVG exists in 2015.1.  If you want the median you might have to calculate that yourself within a function.  Do you need an SQL-only solution?

Yes, I've been using the AVG function. Any solution will do. Any sample code out there? Thanks