Hi All!

I have a problem with a complicated find and I'm stumped...

My database tables are:

Products
- id
- name
... 

Orders
- id
- status
...

OrderItems
- id
- order_id
- product_id
- quantity
- line_total
...

And Models are: 

Orders hasMany OrderItems
OrderItems belongTo Products, Orders

And I am trying to query all Products to get total number of OrderItems and 
sum of line_totals where the Order status is completed...

So I can generate a table:

Product Name | Number of Sales | Sales Total
A Bag | 10 | £50.00
...

Can anyone help? I'm getting nowhere fast...

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to