High reward financial report: No. username name (RMB) complimentary (RMB) deposit (RMB) registration fee (RMB) IP address fee (RMB) usage fee (RMB) 0wszxiao1_60100 high reward
Financial statement:
Serial No. username (RMB) present (RMB) deposit (RMB) registration fee (RMB) IP address fee (RMB) usage fee (RMB)
0 wsz xiaobai 60 10 0 0 50 20
1 bbb zhangs 50 0 0 30 30 100
Table A has the following fields:
User (login name)
Name)
-----------------------------
Table B has the following three fields:
Type: (There are five types: renewal, gift, deposit, registration fee, and IP address fee. The value of type varies according to different situations)
Savingnum (bytes)
User (login name)
Time
----------------------------
Table C has the following fields:
User (login name)
Charge1 (usage fee)
Time
----------------------------
Table D has the following fields:
User (login name)
Charge2 (usage fee)
Time
Association: the four tables have the same user and are unique in each table.
Note: it is a report. the values found are the 'and' of a field in a certain range'
The usage fee in each record. if the value in Table D is not empty, it is 0 in Table C. If the value in Table C is not 0, there is no table D.
Problem:
1 Query: Locate the period ($ star_time <= time <= $ end_time) in a certain range of conditions ($ star_savingnum <= savingnum <= $ end_savingnum)
2 Query: in a condition time ($ star_time <= time <= $ end_time), find a range of usage fees ($ star_savingnum <= savingnum <= $ end_savingnum)
------ Solution --------------------
What do you need?
Table 1 B type: (divided into five types: renewal, gift, deposit, registration fee, and IP address fee). The type structure setting has an impact on the statistics.
You can use group by to collect statistics for all types of users or all types of individual users.
2 The structure of the C and D tables is basically the same. I don't know what you call it. (if the value in the D table is not null, it is 0 in the C table; if the value in Table C is not 0, Table D does not exist.) What is the solution.
If a user has a value in Table C and a value in Table D, this increases the difficulty.
------ Solution --------------------
Discussion
What do you need?
Table 1 B type: (divided into five types: renewal, gift, deposit, registration fee, and IP address fee). The type structure setting has an impact on the statistics.
You can use group by to collect statistics for all types of users or all types of individual users.
2 The structure of the C and D tables is basically the same. I don't know what you call it. (if the value in the D table is not null, it is 0 in the C table; if the value in Table C is not 0, Table D does not exist.) What is the solution.
If a user has a value in Table C and a value in Table D, this increases the difficulty.
------ Solution --------------------
Discussion
The charge value of a record exists in Table C (not 0) and does not exist in Table D.
As long as it exists in Table D, it will not exist in Table C (none at 0)
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.