Advice: Based on my current situation, how can I easily obtain the financial report? Delphi/Windows SDK/API
Http://www.delphi2007.net/DelphiDB/html/delphi_20061219223120214.html
I put all the secondary subjects in a table (sub_list)
Field:
Sub_id (level 2 subject 'category ID ),
Sub_name (second-level account name ),
Acc_id (parent account ID ),
Acc_name (parent account name ),
Debit (borrow amount ),
Lender (loan amount ).
Each subject has multiple records
How to generate the following report:
Upper-level account 1 borrow amount, total loan amount,
Level 2 account 1 borrow amount, total loan amount,
Level 2 account 2 borrow amount, total loan amount
.....
Upper-level account 2 borrow amount, total loan amount,
Level 2 account 1 borrow amount, total loan amount,
Level 2 account 2 borrow amount, total loan amount
Lao Feng is here to help. Occupy 80 points
select acc_id, acc_name name, sum (debit) sum_debit, sum (lender) sum_lender from sub_list group by acc_id, acc_name
Union
select acc_id, sub_name name, sum (debit) sum_debit, sum (lender) sum_lender from sub_list group by acc_id, sub_name
order by acc_id, name
Select acc_id, acc_name name, k = 1, sum (debit) sum_debit, sum (lender) sum_lender from sub_list group by acc_id, acc_name
Union
Select acc_id, sub_name name, K = 2, sum (debit) sum_debit, sum (lender) sum_lender from sub_list group by acc_id, sub_name
Order by acc_id, K, name
What is K? Sort?
In my opinion, there are two queries. You cannot implement the results of the preceding report. It is easy to use RM.
You cannot implement the results of the preceding report.
----------------------------
Practice is the only criterion for testing truth.
Thank you, Feng! I 've been in the computer for the past few days, wikin, TMD! Reinstall the system. Try again after installation!