Don't know whether Firebird has internal functions for this or not and it
is likely that there are more elegant solutions available, but the below
queries should be ways to get what you ask (although I don't know whether
you want to return all values for mode and whether or not you want the
Basics of Statistics - Mathematics: Mean (Average), Median, Mode and Range
I want to calculate Mean (Average), Median, Mode and Range in Firebird 2.5 and
3.0.
I know that Firebird internal function for Mean (Average) is AVG(), but what
are the internal functions for Median, Mode and Range in