-
Notifications
You must be signed in to change notification settings - Fork 360
Aggregate function support #16
Copy link
Copy link
Closed
Description
From Sérgio Diniz (by email):
I found one thing that I really miss, is the max function, instead of using a raw query it could be already in your ORM… so I implemented it quickly:
/** * Tell the ORM that you wish to execute a MAX query. * Will return the max value of the choosen column. */ public function max($column) { $this->select_expr('MAX('.$column.')', 'maxvalue'); $result = $this->find_one(); return ($result !== false && isset($result->maxvalue)) ? (int) $result->maxvalue : 0; }I only tested it in MySQL…
Reactions are currently unavailable