Friday, January 30, 2009

sorting/ordering with foreign key

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: