$this->set('states', $this->State->find('all',array('fields'=>'DISTINCT
city_state')));
Use above type...
On Monday, April 10, 2006 7:02:57 PM UTC+5:30, immure wrote:
>
> I need to get a list of DISTINCT elements from a table. Looking through
> the Cake manual/wiki, I can't find any explicit way of doing it in the
> methods, so I'm making a query script to do it. The problem is that it
> returns nothing, has anyone got a better way of doing it? Or a fix for
> my query?
>
> $this->set('feeds',$this->NewsItem->query('SELECT DISTINCT
> `NewsItem`.source_name` AS `source_name`'));
>
> Regards, Mike
>
>
--
You received this message because you are subscribed to the Google Groups
"CakePHP" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
Visit this group at http://groups.google.com/group/cake-php?hl=en-US.