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


>
> 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://cheesecake-photoblog.org/
http://www.sanisoft.com/blog/author/amitbadkas

--~--~---------~--~----~------------~-------~--~----~
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