Reputation: 1107
Hi i want to get distinct values from a particular column from cakephp.
This is what i have tried:-
$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.
I dnt knw what is wrong in the query, can anyone help me out
Upvotes: 0
Views: 230
Reputation: 1590
findAll
is not actually a cakephp method. What you want to do is:
$this->Event->find('all', array('fields' => 'DISTINCT Event.source'));
http://book.cakephp.org/2.0/en/models/retrieving-your-data.html#find-all
Upvotes: 2