An array of questions about the sum of an item

Source: Internet
Author: User
The summation problem of an array for an item
Known quantity Group A:

Array (
0 =
Array (
' Stock_no ' = ' SU13080800340 ',
' Adress ' = ' B ',
' Arr_time ' = ' 2013-08-14 09:00:00 ',
' C_type ' = ' p32e ',
' Cust_no ' = ' 310f61va5a ',
' Mount_total ' = ' 1 ',
' Total ' = ' 16 ',
' C1_time ' = ' 2013-08-10 15:00:00 ',
' Packageno ' = ' CVT121015001 ',
),
1 =
Array (
' Stock_no ' = ' SU13080800340 ',
' Adress ' = ' B ',
' Arr_time ' = ' 2013-08-14 09:00:00 ',
' C_type ' = ' p32e ',
' Cust_no ' = ' 310f61va5b ',
' Mount_total ' = ' 2 ',
' Total ' = ' 32 ',
' C1_time ' = ' 2013-08-10 15:00:00 ',
' Packageno ' = ' CVT121015002 ',
),
2 =
Array (
' Stock_no ' = ' SU13080800340 ',
' Adress ' = ' B ',
' Arr_time ' = ' 2013-08-14 09:00:00 ',
' C_type ' = ' p32e ',
' Cust_no ' = ' 310f61va5b ',
' Mount_total ' = ' 2 ',
' Total ' = ' 32 ',
' C1_time ' = ' 2013-08-10 15:00:00 ',
' Packageno ' = ' CVT121226001 ',
),
)


How to obtain the results of the corresponding Packageno of the items in the array and the sum of the stock_no corresponding to the Mount_total and total items respectively? cust_no
Assuming that the cust_no is 310f61va5a, the corresponding Packageno is CVT121225001.
When the Cust_no is 310f61va5b, the corresponding Packageno is cvt121225002,cvt121226001.

When the Stock_no is SU13080800340, the mount_total result is 3 (1+2) and the total result is 48 (16+32).

How to achieve this effect?

Share to:
  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.