基于键的数组总和(按用户分组)

时间:2018-04-28 20:40:26

标签: php mysql arrays sum array-sum

enter image description here

这是我从mysql获得的第一个数组

Array    
([0] => Array
    (
        [created_by] => 4
        [count] => 1
        [total] => 300
    )

[1] => Array 
    (
        [created_by] => 4
        [count] => 1
        [total] => 450
    )

[2] => Array
    (
        [created_by] => 3
        [count] => 1
        [total] => 500
    )

我需要输出

[0] => Array
    (
        [created_by] => 4
        [count] => 2
        [total] => 750
    )

[1] => Array
    (
        [created_by] => 3
        [count] => 1
        [total] => 500
    )

基于created_by的数组总和 需要按created_by count分组。

0 个答案:

没有答案