try this:

$this->Invoice->findAll(null, array('DISTINCT Invoice.customer_id'));


On Thu, May 28, 2009 at 1:58 PM, Matt <mmanai...@gmail.com> wrote:
>
> I am trying to get a distinct list of invoices based on the
> customer_id using the following line:
>
> $this->set('invoices', $this->Invoice->findAll(null, 'DISTINCT
> customer_id'));
>
> Problem is that it doesn't work as it should since the query comes out
> like this:
>
> SELECT DISTINCT `Invoice`.`customer_id`, `Invoice`.`id` FROM
> `invoices` ....
>
> Since it selects the Invoice.id as well as the distinct
> Invoice.customer_id, my results aren't distinct at all!
>
> Can anyone help me pleeeeeeease? :)
>
> Thanks,
> Matt
> >
>

--~--~---------~--~----~------------~-------~--~----~
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 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to