How to use aggregate functions like sum (), count () in Magento ORM.
Consider the table "test" with the following values
------------------------------------- productid | qty ------------------------------------- 1 | 2 ------------------------------------- 2 | 3 ------------------------------------- 3 | 5 -------------------------------------
and if I matched this table in my module so that I can get collection data, for example
$_collection = Mage::getModel('mymodule/customcart')->getCollection();
$_collection = Mage::getModel('mymodule/customcart')->getCollection();
How to get result equivalent to below query using COLLECTION?
select sum(qty) from test;
select sum(qty) from test;
source share