Is there a way to query for a record that with the MAX value on an int field? Been searching but haven't found any leads.
d
dankent
09/14/2017, 11:44 AM
there's isn't a build in max aggregation but one approach you can use is to sort by the field in descending order and return only one result, using the orderBy and first arguments
Thanks @dankent That's what I did, I was just concerned about the overhead in this technique. In SQL, you wouldn't want to do this for large record sets.
dardub
09/15/2017, 5:45 PM
Though the other day I was thinking maybe just create a field that stores the max value and update that via a hook.