I want to find max value from a table:
knexClient
.queryBuilder()
.withSchema('myschema')
.from('mytable')
.where({some_query})
.max('value');
It returns the needed value as an array with a single element: [{max: 1000}]
Why does it return an array, not just a number, or an object?
knexClient
.queryBuilder()
.withSchema('myschema')
.from('mytable')
.where({some_query})
.max('value')
.first(); // Add this to get an object
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.