find list => distinct?

2012-02-24 Thread heohni
Hi, I have this query: $results = $this->find('list', array( 'conditions' => array('1 = 1'), 'fields' => 'REG_ID, REG_NAME', 'order' => array('REG_NAME ASC') )); and I do a echo $this->Form->input('city', 'options' => $getCities, 'id' => 'city')); to g

Re: find list distinct

2009-05-26 Thread fain182
> What error displays? syntax error, anyway i found the solution: http://blog.pepa.info/php-html-css/cakephp/populating-a-select-box-with-distinct-values/ find( list,..) doesn't support distinct, so i should make a lot of find all and set combine.. thank you ;-) -- pietro --~--~-~--~-

Re: find list distinct

2009-05-26 Thread andy
What error displays? On May 25, 2:21 pm, fain182 wrote: > > Take a look athttp://book.cakephp.org/view/809/find-count > > i tried: > $this->set('stati', >      $this->{$this->Singular}->Sito->Stato->find( >                'list', >                array('fields'=>'DISTINCT stato') >       ) > );

Re: find list distinct

2009-05-25 Thread fain182
> Take a look at http://book.cakephp.org/view/809/find-count i tried: $this->set('stati', $this->{$this->Singular}->Sito->Stato->find( 'list', array('fields'=>'DISTINCT stato') ) ); but results in a SQL error... the query generated is: SELECT `Stato`.`id`,

Re: find list distinct

2009-05-25 Thread andy
Take a look at http://book.cakephp.org/view/809/find-count On May 24, 3:30 am, fain182 wrote: > hello, > i have a table 'posts' like: > id, author, subtitle, text, other fields.. > > i want to make a search with some select(one for author, one for > subtitle, ecc.), what is the best way? it's po

find list distinct

2009-05-24 Thread fain182
hello, i have a table 'posts' like: id, author, subtitle, text, other fields.. i want to make a search with some select(one for author, one for subtitle, ecc.), what is the best way? it's possible to use distinct in combination with find('list',..) ? thank you -- pietro --~--~-~--~