It's a feature, find('list') is usually done to build options for a
select box.

On Aug 20, 8:39 am, bitkidoku <[EMAIL PROTECTED]> wrote:
> What about using 'list' instead of 'all', it is failing:
>
> $this->Production->find('list', array('fields' => 'DISTINCT
> supplier'));
>
> CakePHP is trying to fetch Product.id as well. Is this a feature or a
> bug? :)
>
> On Aug 20, 3:12 pm, "Amit Badkas" <[EMAIL PROTECTED]> wrote:
>
> > 2008/8/20 Amit Badkas <[EMAIL PROTECTED]>
>
> > > 2008/8/20 bitkidoku <[EMAIL PROTECTED]>
>
> > >> Hello everyone,
>
> > >> I am using CakePHP to build an application that will run on en
> > >> existing database. The problem I am facing is simple, I have products
> > >> table and let's say it is like this: id, name, supplier
>
> > >> Some stupid programmer (yes I am angry to him) didn't created the
> > >> table with supplier_id. So every time a product is being added
> > >> supplier field must be entered manually. This is not my problem. What
> > >> I want to do is to retrieve all the unique supplier names.
>
> > > - To get unique suppliers, run query, SELECT DISTINCT supplier FROM
> > > products
>
> > - Or using cake, $this->Production->find('all', array('fields' => 'DISTINCT
> > supplier'));
>
> > >> I tried:
>
> > >> $this->Product->find(
> > >>        'all',
> > >>        array(
> > >>                'fields' => array('Product.supplier'),
> > >>                'group' => 'Product.supplier'
> > >>        )
> > >> );
>
> > >> It does not work. When I query the database manually using "SELECT
> > >> supplier FROM table GROUP BY supplier" it works.
>
> > >> Thank you very much for your answers.
>
> > --
> > Amit
>
> >http://amitrb.wordpress.com/http://coppermine-gallery.net/http://chee...
>
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to