Premise concept:
There are 12 months in a year, different in each company's annual report beginning.
For example:
Company A is the beginning of the month in A year on July
That is:
7 8 9 10 11 12 1 2 3 4 5 6
Company B is the beginning of the month in a year in April
That is:
4 5 6 7 8 9 10 11 12 1 2 3
Now to statistics the company every month this year how many activities.
Known, the company can be the beginning of the month, in the company list.
Each month how many activities can be obtained in calendar list
Example:
Company A beginning July
Activity in several
7 2
10 5
Now define the column 1... The column 12
Column 1=company start month (that is, it is possible that in July, it is possible that April)
For help, my logic how should write to any company in the retrieval,
Can start ~ the last months of order will retrieve results assignment??????
Logic can't write, some meng.
CodePudding user response:
I think good can be generated according to the company prior to query in array
Then select sum (activity) in the month of the where (array)
CodePudding user response:
reference 1/f, DF, SKy's reply: I feel good can be generated according to the company prior to query in array Then select sum (activity) in the month of the where (array) operations of a company, what I mean is that the column name (start month) and how the activities of the corresponding number of dynamic assignment, Such as A person, are now operating firms are shown from July to June order If company B, the display order of April ~ 3 months CodePudding user response:
Vertical table variable cross table? Still? CodePudding user response:
Company started on variable can leave a database interface or directly, allows users to set themselves up the values stored in variables, CodePudding user response:
Each company is different to the user's own configuration data, convenient query, CodePudding user response:
?? Is not what I want is the result of the When the company A page view is as follows: July August September October... 10 0 0 5 Company B page view is as follows: In April, may, June July... October... 0 0 0 10... 5... CodePudding user response:
The ℡ reference 4 floor? ? 2? 1?? Response: company started on variable can leave a database interface or directly, allows users to set themselves up for the values stored in variables, didn't read it CodePudding user response:
You still send your activity history data, and this month you is how to specify CodePudding user response:
Check the data from the database? Suggest your table structure and the desired results CodePudding user response:
If, I now give you a data sheet, is a company, don't worry about a few months I only have one request, "give me a monthly statistics" -- -- -- -- -- -- -- will, Ok, if I said 2 companies, also don't worry about a few months, My request is "according to the company and give me two latitude statistics" - will Now, I'm talking about A company is only the first three quarters of the statistical will -- -- -- Actually, this is no logic, don't tangle, according to the company and time query data (this time I also don't say what is configuration or watch, I just said that he was just two parameters of the stored procedure parameters from there, I don't care, you could get into), and then just give me a monthly statistics, CodePudding user response:
refer to the eighth floor big watermelon a WuYiJin reply: you still send your activity history data, and how did you go to the specified in the start month? Company list have A start on Company B start month 4 According to company code can find the start month is what As for the active record, that is the calendar table According to the month don't write their own SQL text took a count of how many activities every month CodePudding user response:
references to the tenth floor wanghui0380 response: if, I now give you a data sheet, is a company, don't worry about a few months I only have one request, "give me a monthly statistics" -- -- -- -- -- -- -- will, Ok, if I said 2 companies, also don't worry about a few months, My request is "according to the company and give me two latitude statistics" - will Now, I'm talking about A company is only the first three quarters of the statistical will -- -- -- Actually, this is no logic, don't tangle, according to the company and time query data (this time I also don't say what is configuration or watch, I just said that he was just two parameters of the stored procedure parameters from there, I don't care, you could get into), and then just give me a monthly statistics, but you can not be sorted by month in the page