小编a74*_*045的帖子

如何在magento中使用group by collection对列值求和(使用MAGENTO STANDARD)

我的桌子是这样的,我的收藏是 $testmodel=Mage::getModel(test/p1)->getCollection();

     my database table is below.

    id  cat_id  rate   p_id
     1    1      4      1
     2    1      2      1
     3    1      3      2
     4    2      5      3
     5    2      3      1 
Run Code Online (Sandbox Code Playgroud)

我想使用集合在 magento 中输出这样的输出

       cat_id  rate   count_category
         1      9       3
         2      8       2 
Run Code Online (Sandbox Code Playgroud)

magento

2
推荐指数
1
解决办法
1万
查看次数

标签 统计

magento ×1