テーブルの列expから最大数を選択するにはどうすればよいですか。それが私のテーブルです:
id | name | views |
1|テスト|42|
2 | test1 | 89 |
3 | test2 | 4 |
4 | test3 | 35 |
ビューは他のビューの中で最も多いので、行ID 2のすべての値を選択する必要がありますか?私はこれを試しますが、機能しません:
$q = $this->select()->from($this->_name, array(new Zend_Db_Expr('MAX(views)'), 'id', 'name'))->order('name DESC')->limit(1)->group('name');
return $this->fetchRow($q);