嗨,我想从cakephp的特定列中获得不同的值。
这是我尝试过的:-
$new_data =$this->Event->findAll(null, 'DISTINCT events.source');
Event- is the name of my model.
events- is my table name in db.
Source:- is the column name from which i want to fetch values.
我不知道什么是错误的查询,谁可以帮助我
findAll
实际上不是cakephp方法。你要做的是:
$this->Event->find('all', array('fields' => 'DISTINCT Event.source'));
http://book.cakephp.org/2.0/en/models/retrieving-your-data.html找到所有
$this->Event->find('all', array('group' => 'Event.source'));
$this->Event->find('all', array('group' => 'Event.source'));