Find the maximum value of a field from all the selected records. * * await Flight.max("flightDuration");
(field: string)
| 808 | * await Flight.max("flightDuration"); |
| 809 | */ |
| 810 | static async max(field: string) { |
| 811 | const value = await this._runQuery( |
| 812 | this._currentQuery |
| 813 | .table(this.table) |
| 814 | .max(this.formatFieldToDatabase(field) as string) |
| 815 | .toDescription(), |
| 816 | ); |
| 817 | |
| 818 | return Number((value as AggregationResult[])[0].max); |
| 819 | } |
| 820 | |
| 821 | /** Compute the sum of a field's values from all the selected records. |
| 822 | * |
no test coverage detected