JimiJ13
asked on
How can I group column values as per sample?
These are the sample data that I want to group:
Description Amount
Dues 200
Dues 200
Dues 200
Dues 200
Dues 200
Dues 200
Dues 200
Dues 200
Donation 50
Donation 100
Donation 150
Donation 200
Donation 250
Donation 300
Others 100
Others 100
Others 100
Others 100
Interest 50
Tax 8
I want to have them summarized as follows:
SUMMARY
Dues 1600
Donation 1050
Others 400
Interest 50
Less Tax -8
Net 3092
Thanks.
Description Amount
Dues 200
Dues 200
Dues 200
Dues 200
Dues 200
Dues 200
Dues 200
Dues 200
Donation 50
Donation 100
Donation 150
Donation 200
Donation 250
Donation 300
Others 100
Others 100
Others 100
Others 100
Interest 50
Tax 8
I want to have them summarized as follows:
SUMMARY
Dues 1600
Donation 1050
Others 400
Interest 50
Less Tax -8
Net 3092
Thanks.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Good and helpful solutions!
ASKER
How can I add grouping as follows:
Group Description Amount
A Donation 1050.00
A Dues 1600.00
B Interest 50.00
B Others 400.00
B Less Tax -8.00
Thanks.
Net 3092.00
Group Description Amount
A Donation 1050.00
A Dues 1600.00
B Interest 50.00
B Others 400.00
B Less Tax -8.00
Thanks.
Net 3092.00
Try this code:
Select Description,sum(amount) from tablename group by description;