Domanda

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
È stato utile?

Soluzione

ORM::factory('pages_version')
    ->select(array(DB::expr('MAX(version_id)'), 'max_version'))
    ->where('page_id', '=', '3')
    ->find_all()
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top