Mark Lawton wrote:
> Hi Everyone,
> 
> I would like to switch to using Cake, but looking at
> http://manual.cakephp.org/view/66/models , I don't see an obvious way
> to ask for a calculated ordered list from a database - and these are
> indispensable to our website. Suppose, for example, one wanted the 10
> healthiest cakes: the SQL query might look like this:
> 
> select price, name, 2 * protein + log(fibre) - 10 * salt - sugar - fat
> as health order by health limit 10
> 
> Can somebody tell me how we would be able to do such lists in Cake,
> please?

Well, if I understand well what you want to do, this is just as basic as 
doing a Model->query or a Model->find(All)

As a result you get a set of data ordered the way you asked for it 
inside your query. Browse thru them with a simple foreach loop.

Did I missed something ?


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to [email protected]
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