Question

I dont know how to use this "MAX" with ORM. Use Kohana 3.2.

SELECT MAX( version_id ) AS latest FROM pages_versions WHERE page_id = 3
Was it helpful?

Solution

ORM::factory('pages_version')
    ->select(array(DB::expr('MAX(version_id)'), 'max_version'))
    ->where('page_id', '=', '3')
    ->find_all()
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top