$this->Invoice->find('all',array(),array(), 'invno_id DESC')
When using find() in that way, the $order param isn't an array and, in
any case, the way you had it would be a syntax error.
Personally, I always set up my find like:
$filters = array(
'conditions' => array(...),
'order' => array('Invoice.invno_id' => 'DESC'),
etc.
);
$this->Invoice->find('all', $filters);
On Sat, Jan 31, 2009 at 2:27 AM, forrestgump <vikhyat86@gmail.com> wrote:
>
> Hey Guys,
> Consider the following example
> I have 2 tables....
>
> table1: invnos
> fields: id,invno
>
> table2: invoices
> fields: id,invno_id
>
> now i wish to write a query that will order my find in the invoices
> table according to the invno in the invnos table
>
> can someone help me out with it...the best i could write is...
>
> $this->Invoice->find('all',array(),array(),'order' => 'invno_id DESC')
>
> but it seems to be ordering by the invno_id that i stored in the
> invoices table
>
> thanx in advance,
> Forrestgump
> >
>
--~--~---------~--~----~------------~-------~--~----~
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+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---
No comments:
Post a Comment