Php Classification Summary-php Tutorial

Source: Internet
Author: User
Php classification summary table record:
Loan amount
A 100
B 200
A 50
B 30
C 100

Search sum
It is concluded that a has a total of 150
B Total 230
C total 100


Source code




Reply to discussion (solution)

Select loan, sum (amount) from table group by loan

Okay, you overestimate me,

Table name: Hannah
Name shuliang danjia zongjia
A 100 0.1 10
B 200 0.2 40
A 50 0.4 20
B 30 0.2 6
C 100 0.8 80

Summary by name
Obtain a shuliang 150 zongjia 3o
B shuliang 230 zongjia 46
C shuliang 100 zongjia 80

Find the above source code.

What is the difference?
Select name, sum (shuliang) as shuliang, sum (zongjia) as zongjia from Hannah group by name

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.