Hello all,
I am having problems executing a GROUP BY query. Let's say I have
'sales' table containing 'id', 'product_id' and 'revenue'. I am
trying to find total revenue of a different products. So far I did:
$sales = $this->Sale->find( 'all', array(
'fields' => array('Sale.product_id', 'SUM(Sale.revenue) as
total'),
'group' => 'Sale.product_id'
)
);
It does not work. It returns all of the sales. And I dont see any
'GROUP BY' clause in the query debug information.
Any help is appreciated. Thank you for your answers.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---